sb1
7 years agoOccasional Contributor
Can i copy an existing GUI test and create another test under the same project?
Can i copy an existing GUI test along with the visualizer contents and create another test under the same project?
When i tried to create another blank test and copy the contents, only the exec...
- 2 years ago
What you are seeing is something called pass by value, as opposed to pass by reference. It means that JavaScript copies the values of the variables into the function arguments.
In this example, you would expect the value of myString to be changed to 'New String'. However, we are just passing the value,
function myfunc(sameString) { sameString = 'New String'; } function Test() { var myString = 'Old String'; myfunc(myString); Log.Message(myString); }
The same applies to what you have written. However, I would have expected Variables.testDBTable not to change at all, as you are "passing by value". But it seems like the object value is changing, as shown in this example,
function increaseAge(obj) { obj.age += 1; } function Test() { let person = { name: 'SmartBear', age: 25, }; increaseAge(person); Log.Message(person.age); }
To reset your iterator, insert the following at the end of your function,
KeywordTests.Test1.Variables.testDBTable.Reset();