how to make sure gitlab MR contains unit testcase or not

Viewed 33

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!

1 Answers

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

Related