question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] How to set up junit correctly in gitlab?

See original GitHub issue

Hey! We use 3 reporters configured like this.

// playwright.config.ts
reporter: [
		['line'],
		['junit', { outputFile: 'test-results/junit.xml' }],
		['html', { outputFolder: 'public', open: CI ? 'never' : 'always' }],
	],

and

# .gitlab-ci.yml
  artifacts:
    when: always
    reports:
      junit: test-results/junit.xml
    paths:
      - public
      - test-results

The HTML reporter works great. I see screenshots in the report. But I don’t understand how to set up junit correctly, there are no screenshots in his report in the gitlab interface. I would be very grateful for help

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
pesimeaocommented, Oct 28, 2022

I’m facing this problem also. Is there any solution?

1reaction
Yexiaoxingcommented, Mar 24, 2022

Looks like there are two issues.

  1. According to GitLab code, seems like attachment is only available for failed or error cases. If this is not expected you should fire an issue to GitLab.
  2. Also, I suspect that current junit reporter has a bug that the attachment path is not correct. It is using rootDir as base directory, but if the test result file is not located here, the relative path is always incorrect. Here is link for this case, https://gitlab.com/Yexiaoxing/playwright-test/-/pipelines/500054165/test_report

I have made a test repo and it is working for failed case, https://gitlab.com/Yexiaoxing/playwright-test/-/pipelines/500045223/test_report

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unit test reports - GitLab Docs
To enable the Unit test reports in merge requests, you must add artifacts:reports:junit in .gitlab-ci.yml , and specify the paths of the generated...
Read more >
Unit test report examples - GitLab Docs
Unit test reports can be generated for many languages and packages. Use these examples as guidelines for configuring your pipeline to generate unit...
Read more >
Testing best practices - GitLab Docs
Test performance is important to maintaining quality and velocity, and has a direct impact on CI build times and thus fixed costs. We...
Read more >
Test Cases - GitLab Docs
Create a test case · Go to CI/CD > Test Cases. · Select the New test case button. You are taken to the...
Read more >
JUnit report is not showing my tests (#223132) - GitLab.org
Run a merge request pipeline with it configured to output a junit test report and be sure that you set artifacts.reports.junit to the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found