What I need to do is to create UI test cases
for our application and we have decided to use Selenium
with TestNG
(we're still open to other options if there are considerable advantages).
The tests we are trying to create are tests where several users interact with each other using the application
. Basically we need to have several users logging in in parallel
into our application and perform different actions
. There is a relation between the actions of the users so they need to synchronize
their interaction in some points (e.g a user needs to wait, that a different user performs an action before he can perform his action). This means, that there also needs to have some sort of shared information between the users (I was simply thinking about sharing an object, that will take care of the synchronization points).
How should I structure my scenario where I need to describe the actions of different users, that will run in parallel using TestNG?
Is there a better framework for this or is there a pattern, that addresses this problem? Any suggestions are welcome!
EDIT:
The best I could thing so far is to create a test, where each @Test
method has the actions of each user and then create a Suite
, where I define, that the test methods should run in parallel.
Example:
public class MultiUserTest {
@Test
public void user1Interaction() {
User user1 = new User();
// user1 performs actions
}
@Test
public void user2Interaction() {
User user2 = new User();
// user2 performs actions
}
}
Then create a Test Suite
, where I specify, that the methods of MultiUserTest
should run in parallel.
However I don't really like this solution. I don't like the fact, that I'm relying on an XML configuration
(Test Suite
) to describe the correct behavior of my test (which will not be obvious just by looking at the java
code). I also don't like the fact, that I will not be able to simply run the test by using the TestNG plugin
on eclipse
by doing Run As - TestNG Test
.
Again, any suggestion is very welcome.