0

I have test cases implemented for service level testing and I can execute them in parallel at suite level by using {parallel = tests} as below

<suite name="Suite_Name" parallel="tests" thread-count="10">

If I have a parent suite which comprises of children suites as below, and if I would like to create a Jenkins job to execute this parent suite, is there any way to execute these children suites in parallel[internally each child suite will execute it's test cases parallel]?

<suite>
   <suite-files>
    <suite-file path="./testSuite_1.xml"/>
    <suite-file path="./testSuite_2.xml"/>
    <suite-file path="./testSuite_3.xml"/>
    <suite-file path="./testSuite_4.xml"/>
</suite-files>

I know that selenium grid can be used if we have any web-based test cases, but the cases that I have are not web-based. They are API/service level test cases which are implemented by the customized framework using Java, TestNG and Jax-rs libraries.

Darshan Jain
  • 781
  • 9
  • 19
Kumar M
  • 191
  • 1
  • 1
  • 6

1 Answers1

0

This depends a lot on how you are running your tests. Let's assume that you are talking about running tests within a CI environment. I am going to use GitLab pipelines to illustrate my answer.

If you are able to run a single suite from the command line. Something like runTests suite1. Then, in your pipeline configure a job for each test suite. By assigning all the jobs to the same stage they will run in parallel.

Based on the example your .gitlab-ci.yml would look something like this:

stages:
  - build
  - test

job 1:
  stage: build
  script: runBuild

job 2:
  stage: test
  script: runTests suite1

job 3:
  stage: test
  script: runTests suite2

job 4:
  stage: test
  script: runTests suite3

job 5:
  stage: test
  script: runTests suite4

NOTE: If you add more detail to your question feel free to drop me a message and I will update my answer accordingly. Things like the CI system, build tool, etc. would help.

Jenkins specifics

Thanks for the clarification on your environment. I haven't personally done this with Jenkins. However, Cloudbees have a blog post which talks about running jobs in parallel. Please take a look at the splitting tests section on that post, it might be just what you are looking for.

James Wilson
  • 1,541
  • 7
  • 20
  • Wilson, Thanks for replying to my question. To add more details, I'm using the above mentioned xml file which has children suites on my jenkins job to execute my test cases. When it executes on jenkins, it executes each child suite xml sequentially on one executor of jenkins instance. So I'm wondering that, with the same parent file, is there any way that we can execute those children suites in parallel on multiple executors or multiple slave instances – Kumar M May 09 '19 at 22:28
  • Hi Kumar, I have added some more details (Jenkins specifics) based on a bit of research. Hope this helps. – James Wilson May 10 '19 at 11:39
  • @JamesWilson Hi James, can you tell me how can I run the tests in parallel on Gitlab CI. Here is my .yml file. Is it require to register the node as well .image: maven:3-jdk-8 services: - name: selenium/standalone-chrome:latest alias: gitlab-selenium-server cache: paths: - .m2/repository stages: - test test: stage: test script: - mvn $MAVEN_CLI_OPTS verify -DsuiteXmlFile=DealFlowTestNg.xml -e tags: - dlfl-small-runner – Vaibhav_Sharma Sep 18 '19 at 06:20
  • @Vaibhav_Sharma, it is a little hard to read your .yml file as comments don't allow formatting. Also, it looks like your question is far enough removed from the original post (i.e. specifically running tests in parallel on GitLab with Maven) that it could be a question in it's own right. If you would like to raise a new question please let me know the link and I will answer it. – James Wilson Sep 18 '19 at 10:17