Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

A UnitTest in Geode is a test with very narrow and well defined scope. Any complex dependencies and interactions are stubbed or mocked.

  • Should use JUnit 4 or JUnit Jupiter (aka JUnit 5) syntax
  • File name ends with *Test
  • Should be part of the test source set folder (<geode-module-dir>/test/java)
  • Should complete in milliseconds 
  • Should generally test a single class
  • Typically uses white-box testing, uses Mocks/Fakes and helps guarantee internal quality (quality of code and class design)
  • Follows "A Set of Unit Testing Rules" by Michael Feathers
    • A UnitTest should not do any of the following:
      • communicate with a database
      • communicate across the network
      • access the file system
      • prevent the running of other unit tests in parallel
      • require anything special in the environment (such as editing config files or running an external process)

...

Overall Framework

  • JUnit 4 (including Rules) or JUnit Jupiter (which does not support Rules)
  • Paramerized – JUnit 4.12 has a bug which prevents Parameterized and Category from working together properly
    • Please use CategoryWithParameterizedRunnerFactory from Geode when using Parameterized (see GEODE-1350)

...