Skip to content

Guideline to Run Tests

Vanessa Zhang edited this page Sep 8, 2020 · 10 revisions

This is a guideline that helps you to run tests in MLCP. This article also includes the requirement to verify your contributions to submit a pull request.

Test Environment

MLCP tests require a running MarkLogic Server instance. By default, MLCP runs tests under these MarkLogic configurations:

  • MarkLogic Server with same version of MLCP runs on localhost
  • Documents database is available
  • Documents database uses "Modules" database as module database
  • Port 8000 is available
  • Username/password admin/admin will be used to run tests

You can customize some of these settings with Configurable Test Parameters.

MLCP tests will make the following setups:

  • Enable triple index on Documents database
  • Enable collection lexicon on Documents database
  • Create range element indexes on Documents database
  • Create temporal axes on Documents database
  • Create temporal collections on Documents database
  • Create CopyDst database and CopyDstForest forest if not exist. If the user-specified a custom CopyDst database name, MLCP will also check the existence of the database and create it if necessary.

If a custom test database has been specified, the above setups on Documents database will be applied to the specified one. MLCP won't clean up these setups after tests are finished.

How to Run

To run tests in MLCP, from marklogic-contentpump/ root directory, run command

$ mvn test

Things to note:

  • Maven builds the product before "test" phase.

Configurable Test Parameters

You can customize your test environment settings by specifying additional parameters to the test command. All the below parameters are optional. Default values will be used if not specified.

Parameter Type Default Usage Example Description
test string Not used -Dtest=TestImportDocs Specify the test to run. Read more from Maven Surefile Plugin
testDb string Documents -DtestDb=Documents The database that tests will use
testPort string 8000 -DtestPort=8000 The port that tests will use to talk to MarkLogic Server
skipTests boolean false -DskipTests=false Whether tests should be skipped
testCopyDst string CopyDst -DtestCopyDst=CopyDst The database that tests for COPY command will copy to
testOutputPath string /tmp/mlcpout -DtestOutputPath=/tmp/mlcpout The directory path to save tests output

Verify Your Changes

If you make changes to MLCP, you should verify that your change doesn't introduce any issues by running and passing MLCP unit tests.

CURRENTLY, the bottom line for the project maintainers to take a pull request of your contributions to MLCP is to pass all MLCP tests. Pull requests with failing tests won't be accepted. The unit tests included in MLCP are only a minimum set of all the tests we have for the products. They are only designed for a sanity check.

More contribution policies are under discussion.

Clone this wiki locally