How to use a global variable in a different test case?


My setup is as following:

  • A global variable defined as “name” with type string. Initial value is ‘’ (empty)
  • Testcase Registration, where name will be assigned a random value. This is done by doing = ‘chee’ + time
  • Testcase Login, where the loginname is the global variable name.
  • A test suite collection with these test cases and a few others

What Im trying to achieve is to create a new test account every time the test suite collection runs.

The problem is when I run the test suite collection, the Login testcase will fail, because the global variable name that is used for the login is empty. But in the test case Registration, name is a random value.

I assumed that it would be possible to assign a new value to a global variable, when a test case would run.
Is this assumption wrong and if so, what would be the best way of creating a new value for a global variable?

Or is the problem somewhere else?


I also have the same problem, how can I solve it?