Testcontainers is a Java library that supports JUnit tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.
This project is a Testcontainers implementation for Ignition.
Developing a module and want to automatically start a gateway, load your module, and test against it? This library is for you!
Example
Java, using try-with-resources
:
void createIgnitionGateway() throws FileNotFoundException {
try (IgnitionContainer ignition = new IgnitionContainer("inductiveautomation/ignition:8.1.33")
.withCredentials("myUsername", "myPassword")
.withEdition(GatewayEdition.STANDARD)
.withModules(GatewayModule.PERSPECTIVE)
.withGatewayBackup("./path/to/backup.gwbk")
.withThirdPartyModules("./path/to/module.modl")
.acceptLicense()) {
ignition.start();
String url = ignition.getGatewayUrl();
// ... do something with your gateway!
}
}
Gradle
dependencies {
testImplementation("com.mussonindustrial:testcontainers-ignition:0.1.0")
}
Maven
<dependency>
<groupId>com.mussonindustrial</groupId>
<artifactId>testcontainers-ignition</artifactId>
<version>0.3.0</version>
</dependency>
Future work:
- Version 1.0.0 after more testing.
- Might eventually combine this with my Node.js version and try to submit it as a proper testcontainers community module. Unless IA wants to help make it official…
- 8.3 support. Right now there's an only small amount of configuration you can reasonably apply to a gateway (without jumping through multiple hoops), but that's going to change with 8.3.
Sources
Sponsorship
If you benefit from this library for commercial use, we ask you to consider sponsoring our efforts through GitHub sponsors . Your support will allow us to continue development of open-source modules and tools that benefit the entire community (plus there are some bonuses for sponsors ).