Answers: <p>The Ci.CD pipeline allows having a list of artifacts:</p>
  <pre><code>test:
    stage: test
    script:
      - ./gradlew test
    artifacts:
      when: always
      reports:
        junit: 
          - a/build/test-results/test/**/TEST-*.xml
          - b/build/test-results/test/**/TEST-*.xml
          - c/build/test-results/test/**/TEST-*.xml
  </code></pre>
  
Answers: CC BY-SA 4.0
Answers: 2022-03-07T06:52:14.620Z
Answers: As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer).
Answers: Community
Answers: CC BY-SA 4.0
Answers: 2022-03-07T06:48:48.577Z
Answers: 2022-03-07T06:48:48.577Z
Answers: Petre Popescu
Answers: <p>You can use following to capture test results from all submodules:</p>
  <pre><code>  artifacts:
      when: always
      reports:
        junit: &quot;**/build/test-results/test/**/TEST-*.xml&quot;
  </code></pre>
  
Answers: CC BY-SA 4.0
Answers: 2024-01-17T12:27:36.497Z
Answers: 2024-01-17T12:27:36.497Z
Answers: Jan Stastny
Body: <p>I am trying to setup build scripts for Gitlab CI for a Java/ project with Gradle. The project has three different modules <code>A</code>, <code>B</code> and <code>C</code>, with modules <code>B</code> and <code>C</code> being dependent on the module <code>A</code>.</p>
  <p>All three have a build.gradle file and unit tests inside them. There is also a build.gradle file in the root of the project. I am trying to have test reports available in GitLab CI when a new push is made. I managed to have the test executed with ease by executing the <code>check</code> gradle command with a script similar to this one:</p>
  <pre><code>test:
    stage: test
    script:
      - ./gradlew check
  </code></pre>
  <p>THis, however, does not provide any test reports. In the logs I only see something like this:</p>
  <pre><code>Starting a Gradle Daemon (subsequent builds will be faster)
  &gt; Task :compileJava NO-SOURCE
  &gt; Task :processResources NO-SOURCE
  &gt; Task :classes UP-TO-DATE
  &gt; Task :compileTestJava NO-SOURCE
  &gt; Task :processTestResources NO-SOURCE
  &gt; Task :testClasses UP-TO-DATE
  &gt; Task :test NO-SOURCE
  &gt; Task :check UP-TO-DATE
  &gt; Task :A:compileJava
  &gt; Task :A:processResources NO-SOURCE
  &gt; Task :A:classes
  &gt; Task :A:jar
  &gt; Task :B:compileJava
  &gt; Task :B:processResources NO-SOURCE
  &gt; Task :B2:classes
  &gt; Task :B:compileTestJava
  &gt; Task :B:processTestResources
  &gt; Task :B:testClasses
  &gt; Task :B:test
  &gt; Task :B:check
  &gt; Task :A:compileTestJava
  &gt; Task :Ar:processTestResources NO-SOURCE
  &gt; Task :A:testClasses
  &gt; Task :A:test
  &gt; Task :A:check
  BUILD SUCCESSFUL in 42s
  </code></pre>
  <p>It is good that the build fails if the test fails, but I don't have any indication to what tests were executed, what tests failed or any other information.</p>
  <p>Can anyone help with some resources or hints on how to solve this.</p>
  
Tags: <gitlab><gitlab-ci-runner>
Title: Test reports for Gitlab CI when multiple modules exist
UserDisplayName: Petre Popescu
ThreadText: # Test reports for Gitlab CI when multiple modules exist
  
  (Asked by: username_0 on 2022-03-05)
  
  I am trying to setup build scripts for Gitlab CI for a Java/ project with Gradle. The project has three different modules `A`, `B` and `C`, with modules `B` and `C` being dependent on the module `A`.
  
  All three have a build.gradle file and unit tests inside them. There is also a build.gradle file in the root of the project. I am trying to have test reports available in GitLab CI when a new push is made. I managed to have the test executed with ease by executing the `check` gradle command with a script similar to this one:
  
  ```
  test:
    stage: test
    script:
      - ./gradlew check
  
  ```
  
  THis, however, does not provide any test reports. In the logs I only see something like this:
  
  ```
  Starting a Gradle Daemon (subsequent builds will be faster)
  > Task :compileJava NO-SOURCE
  > Task :processResources NO-SOURCE
  > Task :classes UP-TO-DATE
  > Task :compileTestJava NO-SOURCE
  > Task :processTestResources NO-SOURCE
  > Task :testClasses UP-TO-DATE
  > Task :test NO-SOURCE
  > Task :check UP-TO-DATE
  > Task :A:compileJava
  > Task :A:processResources NO-SOURCE
  > Task :A:classes
  > Task :A:jar
  > Task :B:compileJava
  > Task :B:processResources NO-SOURCE
  > Task :B2:classes
  > Task :B:compileTestJava
  > Task :B:processTestResources
  > Task :B:testClasses
  > Task :B:test
  > Task :B:check
  > Task :A:compileTestJava
  > Task :Ar:processTestResources NO-SOURCE
  > Task :A:testClasses
  > Task :A:test
  > Task :A:check
  BUILD SUCCESSFUL in 42s
  
  ```
  
  It is good that the build fails if the test fails, but I don't have any indication to what tests were executed, what tests failed or any other information.
  
  Can anyone help with some resources or hints on how to solve this.
  
  **Tags:** gitlab, gitlab-ci-runner
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2022-03-07. Score: 1 | Accepted answer
  
  The Ci.CD pipeline allows having a list of artifacts:
  
  ```
  test:
    stage: test
    script:
      - ./gradlew test
    artifacts:
      when: always
      reports:
        junit: 
          - a/build/test-results/test/**/TEST-*.xml
          - b/build/test-results/test/**/TEST-*.xml
          - c/build/test-results/test/**/TEST-*.xml
  
  ```
  
  > **Comments:**
  > **username_1**: As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer).  
  
  ---
  
  ### Answer by username_2 on 2024-01-17. Score: 0
  
  You can use following to capture test results from all submodules:
  
  ```
    artifacts:
      when: always
      reports:
        junit: "**/build/test-results/test/**/TEST-*.xml"
  
  ```
  
  
  ---
  
  