Skip to content

Practice 11 ‐ Code Coverage

Oszkár Semeráth edited this page Dec 2, 2024 · 10 revisions

Code Coverage

Initialization

  • Download the project https://github.com/ftsrg-edu/ase-labs.git.

  • Switch to branch practice-2b-end.

  • initiate Gradle build. Wait for indexing to finish.

Running tests

  • Select a simple test ```logic/src/test/java/hu/bme/mit/ase/shingler/logic/TokenizerTests.java''' and select Right Click | Run TokenizerTest.

  • Observe the result of the unit tests.

Result of running a single test class.

  • Now select **More Run/Debug | Run TokenizerTest with Coverage. You will notice, that a new window will be available called "Coverage". Here, we can observe different coverage metrics.

Result of running a single test class.

  • Check the code annotated with different coverages.

  • Add a new test to improve the Branch Coverage of the Tokenizer class .

  • You can run all the tests by Right click on the subproject (e.g., diversity or similarity) | More Run/Debug | Run 'All Tests' with Coverage

Clone this wiki locally