alibaba82
17 years agoSuper Contributor
Running test in Parallel.
Hello,
I like the feature of running test in parallel but I have one issue and hoping you can help me solve this.
Most of my test start off by createing a user account. In this function i populate the username by using some random number that i generate in my external groovy file.
If the tests are running in a series, everything works fine as the numbers are unique across all test cases.
however, if I run the test in parallel, a lot of tests fail because the username ends up being the same in multiple testcases. we cannot have duplicate usernames.
The function I use for generating username is something like this
Calendar c = Calendar.getInstance();
String timeStamp = c.get(Calendar.MONTH).toString() + c.get(Calendar.DAY_OF_MONTH ).toString() + c.get(Calendar.HOUR_OF_DAY).toString() + c.get(Calendar.MINUTE).toString() + c.get(Calendar.SECOND).toString() + c.get(Calendar.MILLISECOND).toString() ;
String UserName = "QA"+ timeStamp;
Can you suggest a better way so I dont have collissions.
THanks
Ali
I like the feature of running test in parallel but I have one issue and hoping you can help me solve this.
Most of my test start off by createing a user account. In this function i populate the username by using some random number that i generate in my external groovy file.
If the tests are running in a series, everything works fine as the numbers are unique across all test cases.
however, if I run the test in parallel, a lot of tests fail because the username ends up being the same in multiple testcases. we cannot have duplicate usernames.
The function I use for generating username is something like this
Calendar c = Calendar.getInstance();
String timeStamp = c.get(Calendar.MONTH).toString() + c.get(Calendar.DAY_OF_MONTH ).toString() + c.get(Calendar.HOUR_OF_DAY).toString() + c.get(Calendar.MINUTE).toString() + c.get(Calendar.SECOND).toString() + c.get(Calendar.MILLISECOND).toString() ;
String UserName = "QA"+ timeStamp;
Can you suggest a better way so I dont have collissions.
THanks
Ali