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
saimadhusaimadhu 

who to write test case for a method which takes parameters

Hi, 

Iam trying to develop a testcase for controller.

here is my controller.

public with sharing class Handler_Account_CreateSA {


private boolean m_isExecuting = false;
private integer BatchSize = 0;

public Handler_Account(boolean Exe, integer size) {

Exe = isExecuting;
BatchSize = size;
}


public void OnAfterInsert(Account[] accounts) {

--

--
}
how can i write a test case for this.

any suggestions please

crop1645crop1645

Check out the VF Documentation, section entitled '"Testing Custom Controllers and Controller Extensions"

 

It shows how you create a testmethod and set parameters

 

 

Ankit AroraAnkit Arora

It's pretty simple...

 

Let's say I have a cunstructor like this:

 

public Handler_Account() so in test class we just write Handler_Account controller = new Handler_Account() ;

 

now if we have public Handler_Account(boolean Exe, integer size)

 

then just write this in test class:

 

boolean tempBoolean = true;
Integer tempVar = 0 ;
public Handler_Account controller = new public Handler_Account(tempBoolean, tempVar) ;

 

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page