Skip to main content
Roger Wicki (Architonic AG) ha fatto una domanda in #Apex
Dear Community

I have following setup:

@isTest

private class myTestClass {

/** static helper variables to store data across different test classes to

/* accelerate test speed

*/

Boolean isInitiated = false;

// ...

@isTest(SeeAllData=true)

private static void init() {

// create helper variable's values

// ...

}

static testMethod void testStuff() {

if ( !isInitiated ) { init(); }

// test all the stuff to be tested

}

}

Within the init method I use nother helper class I worte independatly to create different sObjects. One of them relies on a custom setting. Now I know that SeeAllData has to be set to true so that the method can access that data, but I do not understand why it doesn't work for the case above. In the documentations, it is not said that the isTest Annotation with the SeeAllData addition may only be used for the actual testMethods... I guess this must be where it fails because otherwise it seems to work correctly...

Any clarification on that?
6 risposte
  1. 17 giu 2016, 13:31
    I have switched to custom metadata types. They are always available and can simply be queried in a test class.
0/9000