Forum Discussion

NicolaFilosa_SE's avatar
NicolaFilosa_SE
Contributor
10 months ago

Variable or Test parameter using "If object" in Keyword test

Hi to everyone,

I have to verify the properties "Exists" and "Enabled" for various tabs and pages. To do it I wanted to use a keyword test, in order to run it every time I have to do the verification, specifying only the object. I thought that the "If object" was the better choice but I can't use a variable or a test parameter in it. I tried using the "if... else" function but I wasn't able to create a correct test.

Can anyone please help me?

Thanks in advance to everyone 

  • rraghvani's avatar
    rraghvani
    10 months ago

    Here's a JavaScript example, which captures the property values contentText, Text and Enabled of Aliases.panelTable.

    Objects.Save(Aliases.panelTable, "config_table", "contentText Text Enabled", "", true);
    Objects.Items("config_table").Check(Aliases.panelTable);
    

    It then checks Aliases.panelTable with the property values stored in Stores.

  • Hi rraghvani, thank you for the response but the situation is slightly different. I have to do this test like 100 times and every time the object is different. The objects are, obviously, already mapped. I wanted to have a keyword test that I can recall inserting only the object that I need to test.

    Thank you

    • rraghvani's avatar
      rraghvani
      Champion Level 3

      Just curious, why do you have to do the test 100 times? Is your test data dynamically  or UI changing?

      The other approach is to have the objects defined in a spreadsheet, read the values, and pass this into your keyword test.

      • NicolaFilosa_SE's avatar
        NicolaFilosa_SE
        Contributor

        I have to validate a lot of pages of a web app, containing a lot of buttons. This is the reason why I'm trying to create an unique function that can be reused easily. How can I define objects in a spreadsheet?