testingkatalon-studio

Test that Verifies Element Text H2 equals "some text " + ${variable}


I have created a simple test which opened browser, navigated to url, keyed in a search value of 123456789123456 and checked the page navigated to has an H2 element with the text "No Details for Device with IMEI Number 123456789123456 found". This works fine. I now have introduced a variable IMEINumber which is linked to an internal Data File of 5 IMEINumbers I have successfully altered the Set Text step to utilise the variable but struggling with the Verify Element Text step.

My Step values are:

Item                   Object  Input
Verify Element Text    H2      "No Details for Device with IMEI Number " + ${IMEINumber} + " found"

How do I incorporate the variable into the string. Or is there a way to just test that the H2 element contains the value of variable IMEINumber. Any help apreciated


Solution

  • Schoolboy error... anything in ${} can be included in the text as long as you use back ticks... so the fix is:

    `No Details for Device with IMEI Number ${IMEINumber} found`