rspec/rules/S5395/apex/rule.adoc

33 lines
923 B
Plaintext
Raw Normal View History

2021-04-28 16:49:39 +02:00
``++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)++``.
2021-04-28 16:49:39 +02:00
== Noncompliant Code Example
----
@isTest(SeeAllData=true) // Noncompliant
public class MyTestClass {
@isTest(SeeAllData=true) // Noncompliant
static void myTestMethod() {
// Can access all data in the organization.
}
}
----
2021-04-28 16:49:39 +02:00
== See
* 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[]