Skip to content

Latest commit

 

History

History
46 lines (26 loc) · 2.61 KB

testing.md

File metadata and controls

46 lines (26 loc) · 2.61 KB

Testing

Running Tests

To run the tests;

mvn test

To generate a test coverage report;

mvn test jacoco:report

The generated report will be in "target/site/jacoco/index.html".

coverage

Test coverage is 100% - the only untested code is GildedRoseExpandsApplication#main(String[] args), which is only one line long (and not easily unit tested).

Integration Tests

There are several integration tests in /src/test/java/com/miw/gildedroseexpands/integrationtests.

The main test classes are;

These all use the TestRestTemplate to make real request to the system. Test data is pre-populated.

Spring Tests (Controllers and Services)

There are several spring tests -

  • item - tests associated with the ItemEntity. This includes ensuring viewing and buying sends events (see arch) and the support services are working correctly.
  • inventory - tests associated with Inventory (i.e. allocating inventory)
  • surgetracking - tests recording, purging, and counting views associated with viewing item (determines if a price should be surged).

These will test the Repository, Controller, and any Services. They typically mock (mockito) dependencies to make sure that they are being correctly called.

Unit Tests

There are a set of simple unit tests in trivialobjecttests.

These tests are for objects with little-to-no behaviour (i.e. JPA Entities, ViewModel Objects) and some very simple functionality (i.e. TimeTests).