You need to sign in to do that
Don't have an account?
Unknown annotation: testSetup
I just finished writing and testing my apex and visual force page in Spring '15. I decided to use the @testSetup method since I have a few different ways that I wanted to test this code. I used the standard syntax, and all was well in Spring '15 - 85% code coverage, not perfect but I can come back to refine later for those extra few percentage points - Time to DEPLOY to production! Not so much.
Validation fails in production (Winter '15) with the error: Unknown annotation: testSetup ...
I tried switching the API version to a lower version (droped it to 30) and the annotation error persists.
I followed the instructions here to no avail:
https://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#CSHID=apex_classes_annotation_testsetup.htm|StartTopic=Content%2Fapex_classes_annotation_testsetup.htm|SkinName=webhelp
My test class is structured properly and has no errors in my sandbox. Is this just a bug in the Spring '15 beta?
@isTest public class ClubMembershipControllerTest { // // First, set up our dataset that all other test methods will use // @testSetup static void setup() { // my inserts are here } // // This is a negative test to make sure that the student application cannot be duplicated. // This test is specifically to test the trigger code. // public static testMethod void studentClubApplicationTest() { // first test case that uses the above inserts. } }
What you're going to have to do is either modify your test code to construct the data for each of your methods, or simply wait until the Spring release is rolled out to your instance.
All Answers
This leads me to believe that it should be available in v30+ as well since there is no notice of deprication.
What you're going to have to do is either modify your test code to construct the data for each of your methods, or simply wait until the Spring release is rolled out to your instance.
Apparently I missed this in the Spring '15 release documentation. It would be nice if the standard documentation actually mentioned when it would be released if it's part of a pre-release/Beta, as I thought it was available.
http://releasenotes.docs.salesforce.com/en/spring15/release-notes/rn_apex_test_setup_methods.htm