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
AniqaaaAniqaaa 

Unit Testing

Hello Guys,

 

I am new to Salesforce and would like to know if someone could tell me how to carry out uni tests?

 

I have got some idea: but not sure where, how and what to do the test on exactly

 

@isTest

public class AccountInvoicerTest

{

public static testMethod void TestInvoiceAccount()

 {

Test.startTest();

Test.stopTest();

  }

system.assert();

system.assertequals();

 

Helo would be much appreciated :)

 

Thanks

tommytxtommytx

I will make a deal with you,  please go here first and build as much as you can figure out then come back here and post your live code (along with however much test code you could build) and I will help you write the test procedure.  It takes forever to give tips for you to try.  For me to help with the procedure, I need to see the live code that you need to build a test mode for..... then its pretty easy.

Be sure to enter you code in the code box as it makes it much easier to read.

 

 

Vinit_KumarVinit_Kumar

Agreed with Tommy,

 

Please read the documentation for Apex Test and then you can let us know for what you have to write the Test class,then we can help you out.Please go throug the link for the documentation of Apex Test :-

 

http://wiki.developerforce.com/page/An_Introduction_to_Apex_Code_Test_Methods

netspidernetspider

 

Read this http://wiki.developerforce.com/page/An_Introduction_to_Apex_Code_Test_Methods

 

The basic idea of unit tests are

 

public class AccountInvoicerTest

{

public static testMethod void TestInvoiceAccount()

 {

//CREATE TEST DATA FOR YOUR CODE TO WORK WITH

Test.startTest();

//THE CLASS AND FUNCTION THAT YOU ARE TESTING

Test.stopTest();

  }

//ASSERTS TO PROVE THAT THE RESULTS OF THE FUNCTIONS YOU ARE TESTING WORK

system.assert();

system.assertequals();