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 populated
This When scenario is generated into a function:
When("the {arg} number, {arg} name, and {arg} id are entered", function (number, name, id) {
//code to set the inputs
log.message(id);
}
The id variable is only being set to 1234 instead of receiving 01234. I have attempted to set the parameters to strings inside the scenario files also, there is no change.
Are there any ideas on how to fix this?
Thanks,
Chris
You can use a step:
When the "0111" number, "name" name, and "01234" id are enteredand 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)
});