I have a variable stateID with value 11 in test case CreateStateID. How do I pass this value to test case DeleteStateID in selenium wedriver?
This works fine in selenium IDE but not in webdriver.
In selenium IDE CreateStateID
storeEval | /\d*$/.exec(storedVars['myLocation']) | stateID
I had to write java code for above statement in my selenium2 program.
In selenium IDE DeleteStateID
echo | ${stateID}
the selenium2 code for this is
System.out.println("${sid}");
which prints out null.
Is the best way to write java method where I pass stateID from one test case to another?
Thanks
As stated in the comments:
Another approach would be have the variable as static variable inside the tests, with getters and setters:
And later in the code:
And in another test:
Works ok in mine tests