Skip to content

rogervinas/testing-playground

Repository files navigation

CI

Testing Playground

Mutation Testing

Mutation Testing using pitest

Mutation testing is conceptually quite simple. Faults (or mutations) are automatically seeded into your code, then your tests are run. If your tests fail then the mutation is killed, if your tests pass then the mutation lived. The quality of your tests can be gauged from the percentage of mutations killed.

Property-based Testing

Property-based Testing using Kotest

Instead of writing example-based tests, with property testing, hundreds or thousands of values are fed into the same test, and the values are (usually) randomly generated by your property test framework

Snapshot Testing

Snapshot Testing using origin-energy/java-snapshot-testing

Advantages of Snapshot Testing

  • Great for testing JSON interfaces ensuring you don't break clients
  • Fast and easy to test
  • Will implicitly test areas of your code you did not think about
  • Great of testing dynamic objects

Disadvantages of Snapshot Testing

  • You need to ensure your test is deterministic for all fields
  • Does not give great insight to why the snapshot failed
  • Can be difficult to troll though large snapshot changes where you might only be interested in a small set of fields