Use one variable across all test cases in a test suite

Hello,

I have three test cases that create a user, edit user and delete user in our application we’re developing. I’m mostly using script mode because it’s easier but I have an issue: I created a test suite that executes all three test cases, one after another. I declared a string variable in first test case, eg.

String username = ‘testUser’ + rndTimeStamp;

I want to use that variable in all three test cases when I run the test suite. How could I do this?

Just use GlobalVariable.

  1. You define a GlobalVariable.USERNAME of type String in the Execution Profile “default”.
  2. Your first test case creates the value and set it into the GlobalVariable.USERNAME
  3. The following test cases can refer to the GlobalVariable.USERNAME
  4. A GlobalVariable has the scope of a Test Suite; every Test Cases in a Test Suite shares the GlobalVariable.