I have set up the Regression Tests for my maven spring application using Rest Assured and TestNg framework and it works fine. I would like to set up unit tests for the same using Junit5 and get code coverage. Shall I still write Integration Tests for the application and still be able to get code coverage for Integration Tests. Is it a good idea to get Code Coverage for Integration Tests ? And is it a good idea to get code coverage for Regression tests as well ? If yes, how can i get them ?
And can I integrate the unit tests and Integration Tests(if answer is yes) to CI/CD like jenins? Kindly help me with the query.
Please run a unit test if you require Code coverage for the coded lines. Regression and integration testing shouldn't include it. It is definitely not a good idea. Even unit tests include code coverage information for the lines that have been implemented, not just a complete set of different unit level tests. Focus on unit testing if your goal is to increase code coverage. Focus on integration and regression testing if you want test coverage. Given the clear responses, I hope.
Note: A different type of coverage machine is used if you want to cover API layers.