You need to sign in to do that
Don't have an account?
vasu takasi
how to get a particular variable from a method for writting test method
hi i have code like
public class abc
{
string s1='picklist';
string s2;
string s3;
public void m1()
{
if(s1=='picklist')
{
//some code here
}
else if(s1=='text')
{
//------------
}
}
}
in text method how to pass s1 value ?;
please help me.
public void m1(String parameter){
if(s = 'picklist') System.Debug('Hello');
}
You have to call the function like this:
m1(yourString);
the string you pass will be the parameter the function gets.
public static testmoethod void testClass(){
abd a = New abc();
a.S1 = 'picklist';
a.m1();
//Then test for results here
a.S1 = 'text';
a.m1();
//Test for results here
}
You instantiate the class, then set the variables, then execute your method as above