1

I'm having problems with my test methods. For example, I stripped everything else down from this code

@isTest
global class RestSalesData_TEST {

    testmethod static  void testRestSalesData() {
        Test.startTest();

        test.startTest();

    }   

}

And I get the error "Method does not exist or incorrect signature: Test.startTest()"

Same with other methods such as Test.setMock.

Any ideas?

1 Answer 1

1

Open up your list of classes. Odds are, you have a class named Test, which is shadowing the system Test class. You can rename/remove the class, or you can use System.Test instead:

System.Test.startTest();
4
  • 1
    How the heck is that not a reserved keyword...
    – Adrian Larson
    Jan 11, 2017 at 0:16
  • @AdrianLarson For more fun and games, create a class named Schema...
    – sfdcfox
    Jan 11, 2017 at 0:24
  • Oh man, that breaks all the workarounds for naming collisions. That's just evil.
    – Adrian Larson
    Jan 11, 2017 at 0:27
  • 1
    @AdrianLarson It also disables all Schema methods, like Schema.getGlobalDescribe, because System.Schema doesn't exist :pout:
    – sfdcfox
    Jan 11, 2017 at 0:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .