You need to sign in to do that
Don't have an account?
RossK
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. } }
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
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.