36 lines
970 B
Plaintext
36 lines
970 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)
|
|
|
|
include::message.adoc[]
|
|
|
|
endif::env-github,rspecator-view[]
|