function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
RossKRossK 

API 28.0 Test Cases Must be in a Test Class? Is this true?

Hello!

 

I am having a problem with test methods written in API version 28.0.  The following code snippet gives a  

 

Compile Error: Test methods must be in test classes at line 3 column 28 

 

It works fine in API 27.0.  Why is this occurring? Was this change to the API done with intent?  Is it documented anywhere? Do I need to move all of my Test Methods into a Test Class to use the most recent API?

 

Thanks so much!

 

public class myClass {
    static testMethod void myTest() {
       // Add test method logic using System.assert(), System.assertEquals()
       // and System.assertNotEquals() here.
     }
}
Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

Yes, this is true and intentional.

 

It is documented in the release notes at: 

 

https://na6.salesforce.com/help/doc/en/salesforce_summer13_release_notes.pdf

 

you can now give access to private methods/properties to the test class so you don't need to colocate the test and the code for that reason.

 

You will need to move your test methods to their own test class to use the latest api.  If you stick at version 27 you don't have to do anything.

 

 

All Answers

bob_buzzardbob_buzzard

Yes, this is true and intentional.

 

It is documented in the release notes at: 

 

https://na6.salesforce.com/help/doc/en/salesforce_summer13_release_notes.pdf

 

you can now give access to private methods/properties to the test class so you don't need to colocate the test and the code for that reason.

 

You will need to move your test methods to their own test class to use the latest api.  If you stick at version 27 you don't have to do anything.

 

 

This was selected as the best answer
RossKRossK
Thank you!!!!