Forum Discussion

chris2pher's avatar
chris2pher
New Contributor
6 years ago

Testcomplete BDD Step definitions script dropping leading zero parameter

I am using Testcomplete 14's BDD Scenario files to write a scenario such as..   Given a window is open When the 0111 number, "name" name, and 01234 id are entered Then the fields are populate...
  • IStaroverov's avatar
    6 years ago

    You can use a step:
    When the "0111" number, "name" name, and "01234" id are entered

    and a step handler:
    When("the (.*) number, (.*) name, and (.*) id are entered", function (param1, param2, param3){
    param1 = param1.match(/"(.*)"/)[1];
    param2 = param2.match(/"(.*)"/)[1];
    param3 = param3.match(/"(.*)"/)[1];
    Log.Message(param1)
    Log.Message(param2)
    Log.Message(param3)
    });