Skip to content
XQuery Java XSLT JavaScript CSS Shell
Branch: master
Clone or download
jamesagardner Releasing 1.0.0 (#89)
* Issue #44: assert-equal-json inconsistent in comparisons (#85)

Fixing issue where empty sequences were not being considered equal to one another when using assert-equal-json().

* bintray config fixes

I am running "gradle -i bintrayUpload" from the root project directory, and all 8 artifacts are published seemingly successfully, but the bintray plugin still throws an error. The notes on the 1.8.4 release imply that 1.8.4 fixes a bug regarding publishing something multiple times, but that appears to be the error. But, the packages still seem to be uploaded successfully.

* Updating Home page
- Description of marklogic-unit-test and marklogic-junit
- Links to sample projects
- Moving contributing data to wiki

* Fixing cvsUrl for each project

* Renaming marklogic-junit to marklogic-junit5 (#78)

This allows for marklogic-junit5 to be published under marklogic-community

* Improving the project landing page (#73)

Adding instructions for getting started using marklogic-unit-test.

* Fixing Bug #79 with Suite Names in Test names (#83)

- Test names that started with the suite name no longer throw a module
  not found error.

* #79 Updating assertion to be more specific (#84)

- Adding a better failure message

* Releasing Version 1.0.0

* Fixing Travis CI error (#90)

Changing Travis CI distribution to Trusty which still supports Oracle JDK 8

* fix AbstractMarkLogicTest.java javadocs (#93)

Correcting the JavaDocs. Several methods had @param that did not exist

* Update CONTRIBUTING.md (#94)

Questions or Problem linking to non-existent anchor. Removing it.

* Apply $params in xdmp:xslt-invoke() for coverage report format transforms (#95)

Can now take advantage of the test-dir parameter in an XSLT transform.

* Change test from name() to use self axis (#96)

name() will return the namespace-prefix of the instance XML document, which may not use "error". Changing to use the self:: axis and use XPath to test if it is an error:error element.

* Update XmlNode.java to use the diamond operator <> (#97)

No need to repeat the type on the right hand side

* new ByteArrayInputStream(xml.getBytes()) relies upon the default character encoding of the system to convert the string to a byte array. (#98)

Instead, use new InputSource(new StringReader(xml))

The StringReader avoids having to convert to a byte array and will send the character stream to the InputSource, which will determine the encoding through standard XML API parse rules.

* Abstract mark logic test logger (#99)

* Remove unnecessary declaration of logger that is shadowing the logger from LoggingObject that it extends.

* Remove unused imports (now that logger is not explicitly initialized here)

* #46 Change test failure stack output from encoded XML to a tabbed text format (#61)

* Updating 1.0.beta references to 1.0.0 (#101)

* Updating MarkLogic Copyrights to 2019 (#102)

* Removing Roxy reference (#103)

* Updating Change Log for 1.0.0
Latest commit 63a8aa4 Sep 13, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.travis renaming from ml-unit-test to marklogic-unit-test Sep 20, 2018
gradle/wrapper adding travis suport Jun 7, 2018
marklogic-junit5 Releasing 1.0.0 (#89) Sep 13, 2019
marklogic-unit-test-client Releasing 1.0.0 (#89) Sep 13, 2019
marklogic-unit-test-modules Releasing 1.0.0 (#89) Sep 13, 2019
src Releasing 1.0.0 (#89) Sep 13, 2019
.editorconfig adding new files Jul 10, 2018
.gitignore ignoring .vscode Sep 20, 2018
.travis.yml Releasing 1.0.0 (#89) Sep 13, 2019
CHANGELOG.md Releasing 1.0.0 (#89) Sep 13, 2019
CONTRIBUTING.md Releasing 1.0.0 (#89) Sep 13, 2019
LICENSE Releasing 1.0.0 (#89) Sep 13, 2019
NOTICE.txt
README.md
gradle.properties Releasing 1.0.0 (#89) Sep 13, 2019
gradlew adding travis suport Jun 7, 2018
gradlew.bat adding travis suport Jun 7, 2018
settings.gradle Renaming marklogic-junit to marklogic-junit5 (#78) Jul 8, 2019

README.md

GitHub release GitHub last commit License

Testing MarkLogic

marklogic-unit-test is a testing framework that allows a project to test MarkLogic code. With one import a project immediately has access to:

  1. A framework for writing and running MarkLogic unit tests, including several built in assertion functions
  2. A UI for viewing and running unit tests entirely within MarkLogic
  3. A REST endpoint to run and report unit tests with other tools

Testing MarkLogic from a Java project is made easy with marklogic-junit5:

  1. Write MarkLogic tests entirely from Java
  2. Easily integrate MarkLogic unit tests into your JUnit 5 project

Start using marklogic-unit-test

MarkLogic unit test can easily be integrated into your project as an ml-bundle. The following steps will configure a project to import and use marklogic-unit-tests.

If you'd like to skip straight to the end, you can check out a working example project. You can use that project's build.gradle file as an example of how to use marklogic-unit-test in your own project.

Add marklogic-unit-test to build.gradle

buildscript {
  repositories {
    jcenter()
    mavenLocal()
  }
  dependencies {
    classpath "com.marklogic:marklogic-unit-test-client:1.0.0"
    classpath "com.marklogic:ml-gradle:3.14.0"
  }
}

apply plugin: "com.marklogic.ml-gradle"

repositories {
  jcenter()
}

dependencies {
  mlBundle "com.marklogic:marklogic-unit-test-modules:1.0.0"
}

Add Test Properties to gradle.properties

// Settings for any ml-gradle project
mlHost=localhost    // Assuming local development
mlAppName=my-app    // Application name, defaults to my-app
mlRestPort=8003     // Application Port, defaults to 8003
mlUsername=         // Username used to manage MarkLogic
mlPassword=         // Password used to manage MarkLogic


// Settings specific to marklogic-unit-test
mlTestRestPort=8004 // Testing port, view and run tests from this port

// ml-gradle supports deploying to multiple environments (https://github.com/marklogic-community/ml-gradle/wiki/Configuring-ml-gradle#environment-based-properties).\
// Add the following line to gradle-{env}.properties files for which you would like to deploy the tests. Typically
// tests are only deployed to environments that execute automated tests, like local development and CI environments. 
mlModulePaths=src/main/ml-modules,src/test/ml-modules

Deploy tests using ml-gradle

Now that the environment is configured to load tests and setup a test application servier its time to deploy everything.

./gradlew mlDeploy

To enable quicker feedback between code updates and automated test runs, use the mlWatch task to automatically deploy changes to MarkLogic

./gradlew mlWatch

Access marklogic-unit-test UI

Open a web browser to http://localhost:8004/test/. This is where tests are selected, run, and results are displayed.

If this is a project that's new to marklogic-unit-tests no test suites are displayed because there are no tests.

Creating a test suite

Creating test suites is easy using the mlGenerateUnitTestSuite gradle task. Run the following to setup a sample test suite:

./gradlew mlGenerateUnitTestSuite

Now a new test suite has been generated in src/test/ml-modules/root/test/suites called SampleTestSuite.

If mlWatch is being used, refreshing the web browser at http://localhost:8004/test/ will now show the newly created SampleTestSuite. The suite can be run using the Run Tests button at the top or bottom of the page.

Start using marklogic-junit

Check out the marklogic-junit5 sub-project to get started using marklogic-junit5.

You can’t perform that action at this time.