Getting coverage of tests for a REST project

已回答

I have a project that runs on tomcat with spring boot, and tests that connect to it via localhost:8443.

If I start the server, and then run the tests on a different process, I don't get any coverage.
If I run the tests, and add a Rule saying the tests should run the REST project - then I get good coverage.

Can't I get a coverage if I run only the tests, and the server is running on a different process (but on the same IntelliJ project)?

0

Hi,

If you want to collect coverage from your 'production' code, then you need to pass coverage agent to the VM where your code will work. As far as I understand, this means that you would need to start server with coverage and run tests without coverage. Then you should get coverage information when you shutdown the server.

Anna

0

I started the server with coverage, and ran the tests. Then I stopped the server, and a small Coverage window opened to the right. I saved the gotten coverage HTML file, and looked at it, but although it showed all my method, it had 0 in Class, % Method, % Line, %.

0

Do you see coverage in the view? Or all % are 0 there as well? 

0

请先登录再写评论。