This is the base package for creating an Anvil-Test-Framework developed for testing protocols. It provides functions for creating and running combinatorial tests using JUnit and Coffee4j as well as storing the results. It is compatible with the Anvil Web UI for analyzing the test results.
Notable implementations are:
To use this framework in your project you need to import it as maven dependency.
In your pom.xml you can reference it as follows:
<dependency>
<groupId>de.rub.nds</groupId>
<artifactId>anvil-core</artifactId>
<version>[VERSION]</version>
</dependency>
If you use the Protocol-Toolkit-BOM you can omit the version attribute.
Anvil-Core relies heavily on coffee4j for combinatorial testing. Before you start you should read the quick start guide of coffee4j.
Similar to Coffee4J, you can write combinatorial tests here, as well as normal, simple tests. However, with Anvil-Core you need to declare every parameter type and its possible values beforehand in code.
To create your own Anvil Integration you will have to:
public enum MyProtocolParameterType implements ParameterType {
MY_PARAMETER_TYPE(MyDerivation.class)
@Override
public DerivationParameter getInstance(ParameterScope parameterScope) {
return new MyDerivation();
}
}
public class MyProtocolParameterIdentifierProvider extends ParameterIdentifierProvider {
@Override
public List<ParameterIdentifier> generateAllParameterIdentifiers() {
List<ParameterIdentifier> allMyParameters = new ArrayList();
allMyParameters.add(new ParameterIdentifier(MY_PARAMETER_TYPE));
return allMyParameters;
}
}
metadata.json
file, placed in your resources folderpublic class MyTestClass extends AnvilTestBaseClass {
@AnvilTest(id = "myId_1")
public void myTest(AnvilTestCase testCase) {
ParameterCombination paraComb = testCase.getParameterCombination();
// do the test
testCase.setTestResult(...);
}
}
metadata.json
{
"myId_1": {
"description": "My test description",
"severityLevels": {
"SOME_LEVEL": 42
}
}
}
AnvilTestConfig anvilConfig = new AnvilTestConfig();
// configure
TestRunner runner = new TestRunner(anvilConfig, "", new MyProtocolParameterIdentifierProvider());
runner.runTests();
More details can be found in the wiki under "Integration" (WIP).
Anvil-Core is an open source project and participation is welcome. To set up the development-environment, you will find help here: https://github.com/tls-attacker/TLS-Attacker-Description
To learn more about how Anvil-Core works please read the wiki page under "Development" (WIP).