Forum Discussion

Manojrsr's avatar
Manojrsr
Contributor
8 years ago

Checkpoint Property

In my Test scenario, I have Checkpoint to verify user has logged into system with  correct username.

but in Test log,  for the passed Checkpoint also, General Checkpoint Event is called.

I have call Routines function:

// [UnitA]

//USEUNIT Unit1
function login()
{


Unit1.demo(Browsers.btFirefox,"devarajulu.m@dsrc.co.in","dsrc123456");
Unit1.demo(Browsers.btIExplorer,"manoj.s@dsrc.co.in","Password1");

}

So for the below checkpoint property, first routine need to be failed, second to be passed, for the passed TC, im capturing Screenshot, if failed im logging as checkpoint.

if(aqObject.CheckProperty(Aliases.browser.pageWelcomeToReferralvalet5.formAspnetform.textnodeLblprovidername, "contentText", cmpEqual, "SKS"))
{
CapturePictures();
}

else
{
Log.Checkpoint("Not Valid User");
}

 

I have created General Checkpoint Event to log Checkpoint 

function GeneralEvents_OnLogCheckpoint(Sender, LogParams)
{
Sys.Desktop.ActiveWindow().Picture().SaveToFile("C:\\Users\\Manoj.S\\Desktop\\Test complete forum doubts\\ScreenShot.png")

var PicObj = Utils.Picture;
// Loads an image from a file
PicObj.LoadFromFile("C:\\Users\\Manoj.S\\Desktop\\Test complete forum doubts\\ScreenShot.png");
Log.Picture(PicObj, "Checkpoint Failed");
}

 

 

function CapturePictures()
{
// Saves screenshot into your local
Sys.Desktop.ActiveWindow().Picture().SaveToFile("C:\\Users\\Manoj.S\\Desktop\\Test complete forum doubts\\ScreenShot.png")

var PicObj = Utils.Picture;
// Loads an image from a file
PicObj.LoadFromFile("C:\\Users\\Manoj.S\\Desktop\\Test complete forum doubts\\ScreenShot.png");
// Saves this image to the test log
Log.Picture(PicObj,"UserNameVerified");
}

 

 

 

  • Yes, That is expected only.

     

    aqObject.CheckProperty writes Log.Checkpoit when an property check passed and it writes in Log.Error when an property check fails.

     

    Hence, Whenever you call the Log.Checkpoint(), Corresponding event handler will get called 

     

    https://support.smartbear.com/testcomplete/docs/reference/program-objects/aqobject/checkproperty.html

     

    If you don't that to be called twice then you can modify your function like below,

     

    if(aqString.Compare(Aliases.browser.pageWelcomeToReferralvalet5.formAspnetform.textnodeLblprovidername.contentText, "SKS",true) == 0)
    {
    CapturePictures();
    }
    
    else
    {
    Log.Checkpoint("Not Valid User");
    }
  • shankar_r's avatar
    shankar_r
    Community Hero

    Yes, That is expected only.

     

    aqObject.CheckProperty writes Log.Checkpoit when an property check passed and it writes in Log.Error when an property check fails.

     

    Hence, Whenever you call the Log.Checkpoint(), Corresponding event handler will get called 

     

    https://support.smartbear.com/testcomplete/docs/reference/program-objects/aqobject/checkproperty.html

     

    If you don't that to be called twice then you can modify your function like below,

     

    if(aqString.Compare(Aliases.browser.pageWelcomeToReferralvalet5.formAspnetform.textnodeLblprovidername.contentText, "SKS",true) == 0)
    {
    CapturePictures();
    }
    
    else
    {
    Log.Checkpoint("Not Valid User");
    }
    • Manojrsr's avatar
      Manojrsr
      Contributor

      Hi ,

       

      Thanks much for  alternate solution(aqString.Compare)