Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run same test case in parallel for no of times. (multi-threading support) #53

Closed
aghorpade opened this issue Mar 14, 2018 · 3 comments
Closed
Assignees

Comments

@aghorpade
Copy link
Collaborator

I would like to run same test case for API testing in parallel. e.g. call GET api around 10 times in parallel and see response so I can check if any issue with my code in case of multi-threaded env.

@authorjapps authorjapps self-assigned this Mar 14, 2018
@authorjapps
Copy link
Owner

authorjapps commented Mar 14, 2018

Hi,
Thanks for the question.
This framework leverages the power of JUnit. That means all the advantages and power of JUnit is already available to the you(as users). Also you have advantages of overriding the ZerocodeRunners for your own customization e.g. setting up mocks, doing specific tasks to put the target system in a desirable state etc.

Parallel running is easy and simple, you can run parallely-

  1. Each test wise
  2. Class wise

In both ways you have choices of running the test cases in parallel.

  • Test wise-
<configuration>
    <parallel>methods</parallel>
    <threadCount>2</threadCount>
</configuration>
  • Class wise
<configuration>
      <parallel>classes</parallel>
      <threadCount>2</threadCount>
</configuration>

Suggestion-
Please start with thread count as 2, then increase to 3, then 4, 5... 10 etc to make sure your system is able to spawn so many threads.

Usage-
Look for artefact id <artifactId>maven-surefire-plugin</artifactId> in your POM or module POM.
The configure it below way.

<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${surefire-version}</version>
        <configuration>
            <parallel>classes</parallel>
            <threadCount>2</threadCount>
        </configuration>
    </plugin>

Hope it helps!

If your question is short, concise and you lookin for quick answers, you can even put into the gitter too.

Zerocode is intuitive for users once you start using it!

Regards

@authorjapps
Copy link
Owner

See also how to generate load from your IDE.
e.g.

@LoadWith("your_load_config.properties")
@TestMapping(testClass = AnyTestEndPoint.class, testMethod = "anyTestMethod")
@RunWith(ZeroCodeLoadRunner.class)
public class LoadTest {
}

@Nivetha2020
Copy link

How to pass different testdata when i run the test in parallel by classes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants