You need to sign in to do that
Don't have an account?

Test Method Error
Hi,
I am just trying to write a test method for my class and I am getting the error:
Method does not exist or incorrect signature: Test.StartTest()
Does anyone know what might cause this? I have tried this in a blank class to ensure its not caused by any other code but I still get the same error.
Cheers
James
You don't happen to have a method or variable called Test that is overriding the system method do you?
Could you post the full method?
All Answers
Are you defining the method as a test method?
This works fine for me:
/** * This class is a sample test method */ @isTest private class testme { static testMethod void reallytestme() { system.debug('\n\nI am outside the test area'); Test.startTest(); system.debug('\n\nI am in the test area'); Test.stopTest(); } }
Yes the method is the defined as a test method, the problem has only occurred since the Winter '10 upgrade. Strangely, if I don't use Test.StartTest() and Test.StopTest() the test method seems fine and achieves the code coverage...
Thanks for your help, I wonder what's going on?
James
You don't happen to have a method or variable called Test that is overriding the system method do you?
Could you post the full method?
Sure, this is my method here:
lobal class orderConversion { WebService static void convertOrder(String sQuoteId) { Opportunity qteQuote = [SELECT Id, Name, AccountId, Account.Name, NimbusOM__Order_Number__c FROM Opportunity WHERE Id = :sQuoteId LIMIT 1]; activateAccount(qteQuote.AccountId); } private static Contract activateContract(String sQuoteId) { Contract conContract = [SELECT Id, Name FROM Contract WHERE NimbusOM__Quote_Reference__c = :sQuoteId LIMIT 1]; conContract.ActivatedDate = System.Now(); update conContract; return conContract; } static testMethod void testOrderConversion() { Test.StartTest(); convertOrder(qteTestQuote.Id); Test.StopTest(); }}
As you can see I don't do anything crazy here that should cause an error...
Thanks for this
James
Ah, got it. You were right (both of you :)). It was a class called test which superseded the standard test class.
Cheers for that
James