AKSW / RDFUnit

An RDF Unit Testing Suite
http://RDFUnit.aksw.org
Apache License 2.0
150 stars 42 forks source link

JUnit Integration #49

Closed pepperbob closed 8 years ago

pepperbob commented 8 years ago

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:

@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.

dhiller commented 8 years ago

I think we can close this issue now :)