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
Prallavi DuaPrallavi Dua 

Error in test class in Manage Package

Hi,
In the below link, I found a apex Class the same I copied in my dev org it's showing an error 'Compile Error: Defining type for testMethod methods must be declared as IsTest'
https://developer.salesforce.com/page/An_Introduction_to_Packaging

My dout is do we need to create a separate test class for manage PaCKAGE OR it should be included in the same class.
Thanks.
v varaprasadv varaprasad
Hi Prallvi,

Yes we need create separate class annotated with @isTest.

 
@isTest
public class SampleClass_Test{
  static testmethod void testFoo() {
  SimpleClass a = new SimpleClass();
  a.foo();
  }
}

Hope this helps.
Please check once and let me know in case of any furteher assistance.

Thanks
Varaprasad