MongoDB TestNG

TestNG support for populating a MongoDB databse before a test is run

License

License

Categories

Categories

MongoDB Data Databases TestNG Unit Testing
GroupId

GroupId

com.tensorwrench.mongodb
ArtifactId

ArtifactId

mongodb-testng
Last Version

Last Version

0.1
Release Date

Release Date

Type

Type

jar
Description

Description

MongoDB TestNG
TestNG support for populating a MongoDB databse before a test is run
Project URL

Project URL

https://github.com/TensorWrench/mongodb-testng
Source Code Management

Source Code Management

https://github.com/TensorWrench/mongodb-testng

Download mongodb-testng

How to add to project

<!-- https://jarcasting.com/artifacts/com.tensorwrench.mongodb/mongodb-testng/ -->
<dependency>
    <groupId>com.tensorwrench.mongodb</groupId>
    <artifactId>mongodb-testng</artifactId>
    <version>0.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.tensorwrench.mongodb/mongodb-testng/
implementation 'com.tensorwrench.mongodb:mongodb-testng:0.1'
// https://jarcasting.com/artifacts/com.tensorwrench.mongodb/mongodb-testng/
implementation ("com.tensorwrench.mongodb:mongodb-testng:0.1")
'com.tensorwrench.mongodb:mongodb-testng:jar:0.1'
<dependency org="com.tensorwrench.mongodb" name="mongodb-testng" rev="0.1">
  <artifact name="mongodb-testng" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.tensorwrench.mongodb', module='mongodb-testng', version='0.1')
)
libraryDependencies += "com.tensorwrench.mongodb" % "mongodb-testng" % "0.1"
[com.tensorwrench.mongodb/mongodb-testng "0.1"]

Dependencies

compile (2)

Group / Artifact Type Version
org.testng : testng jar 6.8
org.mongodb : mongo-java-driver jar 2.11.+

Project Modules

There are no modules declared in this project.

MongoTestNG is a base class used for doing setup and teardown of MongoDB database before unit tests that use TestNG. The @MongoData("/file.json") annotation designates a test as using MongoDB.

Data files should be on the classpath for the test and are JSON files that contain an object with one or or more fields. Each field name is the name of a collection, and the value is an array of values inserted into that collection.

{ 
  "collectionName" : [ ], 
  "collectionName2" : [] 
}

This class is intended to be used by a test runner-specific interceptor.

TODO:

  • Skip clear and load if database isn't modified since last test and same data. (via readOnly option on MongoData?)
  • Separate out the test driver, make a JUnit implementation.
  • Let each test have a separate database and not clear it, allowing for post-test inspection of the results.

Versions

Version
0.1