Do you mean you want to increment the “Default value” of “variable” from 0 to 1 by script?
I have an idea how to implement it, but it is not a good approach.
However I would tell you the straight forward scenario how to. The content of Variable tab of a “New Test Case” is serialised into an XML file at the path of “projectDir/Test Cases/New Test Case.tc
”, which looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<TestCaseEntity>
<description></description>
<name>New Test Case</name>
<tag></tag>
<comment></comment>
<testCaseGuid>c46d1117-79df-4d02-a44f-d6a0c03f43e0</testCaseGuid>
<variable>
<defaultValue>'bar'</defaultValue>
<description></description>
<id>d70ab867-638b-4043-a88c-2e4bc5168e19</id>
<masked>false</masked>
<name>foo</name>
</variable>
</TestCaseEntity>
Here you can find an XML element
<defaultValue>'bar'</defaultValue>
This is the serialized format of a Default value of a variable foo
of the Test Case.
You might be able to write a Test Case script to edit this XML file. I guess, Katalon Studio does not prohibit you from doing so.
Let me suppose you have developed that Test Case script. Every time you executed it and edited the XML file, you have to close the project and reopen it. This is to let Katalon Studio reload the edited XML file.
I do not think that this approach is good.
If you are capable of Groovy programming, you should be able to write a script that makes a text file in the project directory, and update it. The script will create a file, for example projectDir/history.json
, with the initial state
{"times":0}
Once your test has run, the file should be updated to:
{"times":1}
Next time it should be updated to:
{"times":2}
and so on.
Your test case script needs to be capable of entirely managing (create/read/write/delete) the file. Skill of Groovy programming is required here.
I have no other idea easier to implement.