We're currently using RDFUnit mainly to test if our transformations are producing RDF that complies to an underlying ontology. The current solution feeds single RDF files (effectively as Jena-Models) - that are produced by an external resource - to RDFUnit one-by-one using a parameterized JUnit-Test. Due to the long running process (~10 minutes ATM) this is usually executed by the CI-System where further reporting takes place (diagrams, statistics, etc.).
So far the process is working, but while integrating this into our dev-pipeline we spotted the following issues:
tests are counted on a "input-model-level" via JUnit, i.e. the actual individual/auto-generated RDFUnit test-cases are not represented as every input file leads to several RDFUnit-TestCases
this lack of granularity makes analysing issues harder as the reporting-scope and -context is usually to big, esp. when there are more than a couple of errors per input
the entire setup is cumbersome and requires quite a bit of boilerplate
Solution: Integrate RDFUnit with JUnit
A solution could foresee a specialized JUnit-Runner that can be configured to provide essential inputs (Ontology, local CVs, Inputs) which reports RDFUnit Test-Cases to JUnit so that this information is not hidden. This could looks like:
@RunWith(RDFUnitJUnitRunner.class)
@Ontology(uri="http://reference.to.ontology")
public class SomeRdfTest {
@ControlledVocabulary
public Model controlledVocabularies() {
Model cvModel = ...
...
return cvModel;
}
@Input
public List<Model> inputModels() {
List<Model> modelsToVerify = ...
...
return modelsToVerify;
}
@After
public void result(Model validationModel) {
// do additional things on the validation results
}
}
Most notably there is no @Test method which is because most of the tests are dynamically/auto generated by the Runner. So for the given ontology a number of RDFUnit TestCases per input is created, executed and reported back to JUnit. Furthermore a Model containing local Controlled-Vocabularies can be provided, validation model can be re-injected after test is run, etc.
Not sure how RDFUnit is/should be used generally but I think this could play out nicely esp. for Unit Tests.
We're currently using RDFUnit mainly to test if our transformations are producing RDF that complies to an underlying ontology. The current solution feeds single RDF files (effectively as Jena-Models) - that are produced by an external resource - to RDFUnit one-by-one using a parameterized JUnit-Test. Due to the long running process (~10 minutes ATM) this is usually executed by the CI-System where further reporting takes place (diagrams, statistics, etc.).
So far the process is working, but while integrating this into our dev-pipeline we spotted the following issues:
Solution: Integrate RDFUnit with JUnit A solution could foresee a specialized JUnit-Runner that can be configured to provide essential inputs (Ontology, local CVs, Inputs) which reports RDFUnit Test-Cases to JUnit so that this information is not hidden. This could looks like:
Most notably there is no
@Test
method which is because most of the tests are dynamically/auto generated by the Runner. So for the given ontology a number of RDFUnit TestCases per input is created, executed and reported back to JUnit. Furthermore a Model containing local Controlled-Vocabularies can be provided, validation model can be re-injected after test is run, etc.Not sure how RDFUnit is/should be used generally but I think this could play out nicely esp. for Unit Tests.