I have this script that repeats 100 times.
I need to know how many times it runs before it fails.
So I I’m thinking of putting a counter in the log each time it starts.
A. Sound like the way to do it?
B. How do you do it?
repeat 100 times
Do stuff successfully
Put <<Test>>&Xtimes&return after file "/Users/johnspitta/Desktop/Logs/TestlinkfileInput.txt"
End Repeat
Hey John–
You can use the repeatIndex() function to see how many times into a loop you are. If you know it’s going to fail, maybe use a try/catch block around the code:
repeat 100 times
try
//do stuff
catch
put repeatIndex() after file "/path/to/file"
//cleanup?
exit repeat --if you want to stop
end try
put repeatIndex() after file "/path/to/file" --if it gets all the way through
end repeat
Hope that helps!
Yup, I actually expect it to fail but I still need to know how many times it ran successfully since each run will produce records in a DB that we need to count.