2

I want to enforce that each GitLab MR should contain unit test case(s). how to make sure GitLab MR contains unit test case or not

Thank you!

kani
  • 61
  • 7

1 Answers1

1

I think a better way is to check what you actually want. You want new code tested. Instead of checking whether the merge request contains a unit test, I think its better to check code coverage.

For this you can use coverage tools like Jacoco for java, Istanbul for Javascript, etc.. GitLab has a way to include this Code Coverage Information directly into the merge Request which I think is a better solution. Now you get line by line information if the new code is tested.

GitLab Merge Request Test Coverage

Leonhard Bauer
  • 316
  • 1
  • 6