marklogic-contentpump icon indicating copy to clipboard operation
marklogic-contentpump copied to clipboard

Separate unit and integration tests

Open hansenmc opened this issue 8 years ago • 2 comments

The current set of tests function mostly as integration tests that require a live instance of MarkLogic, and take ~15 minutes to run.

  • Unit tests should run quickly, and not rely on external systems.
  • Mock objects should be used in place of a live database for unite tests, or the test should be moved into an integration test suite.

It would be helpful, and make it easier for contributors, if the tests and build were organized to facilitate separate execution of unit tests and integration tests. This would also make it easier to integrate with CI services, such as Travis CI and/or Circle CI without having to exclude the test phase.

hansenmc avatar Aug 09 '16 15:08 hansenmc

Given the definition above, all of our "unit tests" are "integration tests". The tests that are included in this repository is less than 5% of all the functional tests we run nightly. We are in the process of migrating more mlcp functional tests here. Or we could call the tests available here "sanity tests".

jxchen-us avatar Aug 09 '16 17:08 jxchen-us

There are a lot of lines of code and functionality that could/should be covered and verified in unit tests. Having a suite of unit tests that provide code coverage, and that can be run quickly/easily would make it easier for users to contribute changes and have some level of confidence that they have not broken anything, or changed expected behaviors. Plus, it helps highlight/focus where the problem might be when it does fail.

We should have both, but having them more cleanly separated and integrated into the build would make it much easier to control whether to execute one and/or the other.

hansenmc avatar Aug 09 '16 19:08 hansenmc