rspec/rules/S5395/apex/rule.adoc
Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
Inline adoc files when they are included exactly once.

Also fix language tags because this inlining gives us better information
on what language the code is written in.
2023-05-25 14:18:12 +02:00

39 lines
1002 B
Plaintext

== Why is this an issue?
``++SeeAllData=true++`` should not be used because it gives your tests access to all data in your organization. Activating this option makes your test dependent on existing data and more difficult to maintain. Tests should create their own data.
This rule raises an issue when it sees ``++@isTest(SeeAllData=true)++``.
=== Noncompliant code example
[source,apex]
----
@isTest(SeeAllData=true) // Noncompliant
public class MyTestClass {
@isTest(SeeAllData=true) // Noncompliant
static void myTestMethod() {
// Can access all data in the organization.
}
}
----
== Resources
* https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_testing_seealldata_using.htm[Salesforce documentation - Using the isTest(SeeAllData=True) Annotation]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Remove "seeAllData = true" from "@isTest"
endif::env-github,rspecator-view[]