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
KrishSinghKrishSingh 

Test Class

Hi All,

 

I am newbie, so can any one tell me what is a test class and how to write it.

 

Krish

Best Answer chosen by Admin (Salesforce Developers) 
Ankit AroraAnkit Arora

 

Test class is nothing else, it is the apex class. Test class is used to check that your controller/business flow is working fine.
Ramp Up Over Test Class :

 

 

 

Thanks
Ankit Arora

 

All Answers

Ankit AroraAnkit Arora

 

Test class is nothing else, it is the apex class. Test class is used to check that your controller/business flow is working fine.
Ramp Up Over Test Class :

 

 

 

Thanks
Ankit Arora

 

This was selected as the best answer
KrishSinghKrishSingh

Thanks Ankit_Arora, this helped me a lot.

 

Best

Krish

KrishSinghKrishSingh

I know we need 75% min of code coverage, can you tell me what does this means?

 

Best

Krish

Ankit AroraAnkit Arora

Code coverage comes in role when you are creating a package, means when you want to deploy your code/functionality/product to any client then you need to create a package.

 

To create a package you need minimum of 75% code coverage of all the classes which you are including in your package.

 

 

Thanks
Ankit Arora

 

KrishSinghKrishSingh

From where I should create a package....?

I have created a visualforce page , class and its test class. I want to send it to other org.

 

Best

Krish

Ankit AroraAnkit Arora

Please let me know on which org you working, is it production/enterprise/developer edition?

 

 

Thanks
Ankit Arora

 

KrishSinghKrishSingh

From where I can check this??? Is it mentioned in setup area???

Ankit AroraAnkit Arora

Just mouse over your browser tab and it will display your edition.

 

 

Thanks
Ankit Arora

 

KrishSinghKrishSingh

It is saying -> User: Krish Singh ~ salesforce.com - Developer Edition.

Ankit AroraAnkit Arora

Thanks for the info. Now click on setup > App Setup > Create > Package > Create a new package > Add your components in it and click upload.

 

Not it will create a URL. Copy that URL and paste it in other browser, now fill credentials of your other org and install the package. Now all classes and pages will be available to use if your package is unmanaged.

 

Make sure your code coverage is above 75% and there is no org dependent data.

 

 

Thanks
Ankit Arora

 

KrishSinghKrishSingh

What do you mean by managed and unmanaged package? I have only option to create unmanaged package and Managed checkbox is disabled.

Ankit AroraAnkit Arora
KrishSinghKrishSingh

Ok I will read this, and really thanks a lot for helping me out.....Your patience is really appreciable. If I have some other problem regarding this, I will throw it down here :)

Hope you won't mind.

Ankit AroraAnkit Arora

Thanks Krish, and sure feel free to ask anything would love to help you :)

 

 

Thanks
Ankit Arora

 

KrishSinghKrishSingh

Hi Ankit_Arora,

 

I have a apex class which send email to users. I am facing error Too many Email Invocations: 11, can you please tell me something regarding this.

 

thanks

krish

Ankit AroraAnkit Arora

This question is bit different from the one for which you have started the thread, so can you please create another post for it?

 

 

 

Thanks
Ankit Arora