Hello,
I wanted to know how could I reuse a Javascript code in different test cases in which a variable value differs in which test case the code is being executed?
For example, I have a step in a test case which contains a javascript code with an if statement:
if(AllForms[i].innerText == “form a”)
However, other test cases will want to use the same javascript code in which the if statement will be:
if(AllForms[i].innerText == “form b”)
… and so on for the following test cases.
I would like to just pass the value as a function instead of having to re-write the the javascript code for each of the test cases.
What would be the best way to approach this when you have different values that are different within the same code and the code is being used in different test cases?
I wanted to use the code as a Paramenter for the step; however, I don;'t think I will be able to just pass a value(s) for the variable(s) depending on the test case(s).
Thanks!