1

So this is my situation:

I am fairly new to gitlab-ci. I don't host my own gitlab instance but rather push everything to gitab itself. I am not using and am not familiar with any build tools like Maven. I usually work and run my programms from an IDE rather than the terminal.

This is my problem:

When I push my Java project I want my pipeline to start the Junit tests I wrote. Whereas I've found various simple commands for other languages than Java to run unit tests I didn't come across anything for Junit. I've just found people using Maven, running the test locally and then pushing the test reports to gitlab. Is it even possible to easily run Junit tests on the gitlab server with the pipeline without build tools like Maven? Do I have to run them locally? Do I have to learn to start them with a Java terminal command? I've beeen searching for days now.

1 Answers1

0

The documentation is clear:

To enable the Unit test reports in merge requests, you need to add artifacts:reports:junit in .gitlab-ci.yml, and specify the path(s) of the generated test reports.
The reports must be .xml files, otherwise GitLab returns an Error 500.

You then have various example in Ruby, Gio, Java (Gradle or Maven), and other languages.

But with GitLab 13.12 (May 2021), this gets better:

Failed test screenshots in test report

GitLab makes it easy for teams to set up end-to-end testing with automation tools like Selenium that capture screenshots of failed tests as artifacts.
This is great until you have to sort through a huge archive of screenshots looking for the specific one you need to debug a failing test.
Eventually, you may give up due to frustration and just re-run the test locally to try and figure out the source of the issue instead of wasting more time.

Now, you can link directly to the captured screenshot from the details screen in the Unit Test report on the pipeline page.

This lets you quickly review the captured screenshot alongside the stack trace to identify what failed as fast as possible.

https://about.gitlab.com/images/13_12/link-to-screenshot-failed-test.png -- Failed test screenshots in test report

See Documentation and Issue.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250