Forum Discussion

vikassardesai's avatar
vikassardesai
Occasional Contributor
5 years ago
Solved

Call Checkpoints dynamically

I want to define Installation screens checkpoints (Region and Object) for each version say version 4.1, 4.2, 4.3 4.4 etc. And for each version some contents of the installation screen are different.

  Can the checkpoints be called dynamically? 

  • Hi,

     

    Yes, this is possible.

    Use eval() or evaluate() function provided by scripting language you are using.

    For example, considering that your checkpoints are named like Screen1_v4_1, Screen2_v4_1, ..., Screen1_v4_2, ... with the current version in proper format stored in the strVersion variable and screen number stored in the strScreenNo variable, consider this code snippet:

    strCmd := 'Regions.Screen' + strScreenNo + '_v' + strVersion + '.Check()'; // the value of strCmd should be like 'Regions.Screen1_v4_1.Check()' (without quotes)

    eval(strCmd);

     

5 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    Yes, this is possible.

    Use eval() or evaluate() function provided by scripting language you are using.

    For example, considering that your checkpoints are named like Screen1_v4_1, Screen2_v4_1, ..., Screen1_v4_2, ... with the current version in proper format stored in the strVersion variable and screen number stored in the strScreenNo variable, consider this code snippet:

    strCmd := 'Regions.Screen' + strScreenNo + '_v' + strVersion + '.Check()'; // the value of strCmd should be like 'Regions.Screen1_v4_1.Check()' (without quotes)

    eval(strCmd);

     

  • LinoTadros's avatar
    LinoTadros
    Community Hero

    Yes you can

    Based on the version number, create an if or switch statement to do the following:

    Regions.Add(...) --> to add an image to the store dynamically

    Regions.AddPicture(...) or addthe picture of an object on the screen to the store

    Regions.Compare(...) to compare the live object on the screen to what you stored using one of the previous 2 methods.

    At the end of the test, you can delete the stored images dynamically as well.

     

    You can do the same with all other checkpoints as well.

    Cheers

    Lino

    • vikassardesai's avatar
      vikassardesai
      Occasional Contributor

      Hi,

        My requirement is If I store multiple checkpoints according to version then I would like to call the checkpoint in a single line - This line should handle the version itself --> Instead of version looping (Using If..else or CASE)