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
naveen kunurunaveen kunuru 

test calss

i am trying to write a test calss for this calss
chkbox obj=new chkbox();
       
        obj.Nm1='naveen';
      
        system.assertEquals(obj.Nm1=obj.Nm2,obj.Nm1=obj.Nm2);
 how to test a boolean variable i mean checkbox
what tag do we got to check a checkbox is true r flase





public class chkbox {
 public PageReference Verify() {
     if (Clk==true)
       {
       Nm2 = Nm1;
       Ph2 = Ph1;
       }
      else
       {
       Nm2=' ';
       Ph2=' ';
       } 
       return null;
    }


    public Boolean Clk { get; set; }

    public String Ph2 { get; set; }

    public String Nm2 { get; set; }

    public String Ph1 { get; set; }

    public String Nm1 { get; set; }
SaranSaran
Hi Naveen,

You can use system.assert(Your Boolean Field).

Test class will get pass if you boolean field is true. Else your class will be failed.

Thanks,
Nitin PaliwalNitin Paliwal
Hi Naveen,
Use syntax like system.assertEquals(Clk , true), or  system.assertEquals(Clk , false) respectively.

Thanks
Nitin