JUnit TestRule
to load data into a database before a test runs.
Usage
public class YourTestClass {
@Rule public TestData testData = ...;
@Test @Load("customers.sql") public void shouldSeeCustomersInDatabase() { // ... }
@Test @Load("orders.sql") public void shouldSeeOrdersInDatabase() { // ... }
}
Supported file formats
- .SQL files for arbitrary SQL statements.
- Create an issue for your desired format
Integration
To use the test-data rule just declare the following dependency inside your POM:
<dependency>
<groupId>com.github.sebhoss.junit</groupId>
<artifactId>junit-testdata-rule</artifactId>
<version>${version.test-data-rule}</version>
</dependency>
Replace ${version.test-data-rule}
with the latest release
Development
License
This program is free software. It comes without any warranty, to the extent permitted by applicable law. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See LICENSE or http://www.wtfpl.net/ for more details.
Setup
This projects uses Java, Maven and Git as the main development tools. To build the project yourself just download & install at least Maven 3.0 and call mvn install inside the project folder. Maven should then proceed to clean, build, package and install this project.
Versioning
This project follows the semantic versioning guidelines.