Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JUnit Integration #49

Closed
pepperbob opened this issue Sep 18, 2015 · 1 comment
Closed

JUnit Integration #49

pepperbob opened this issue Sep 18, 2015 · 1 comment

Comments

@pepperbob
Copy link
Contributor

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.

dhiller pushed a commit to wk-muenster/RDFUnit that referenced this issue Sep 21, 2015
Initial Test Runner that reads out an ontology and converts it into
test cases, needs further description of test cases and their execution.
dhiller pushed a commit to wk-muenster/RDFUnit that referenced this issue Sep 21, 2015
Added first input model extraction, not working though :(
dhiller pushed a commit to wk-muenster/RDFUnit that referenced this issue Sep 21, 2015
Added first input model extraction, not working though :(
Added remaining files :/
pepperbob pushed a commit to wk-muenster/RDFUnit that referenced this issue Sep 21, 2015
Initial Test Runner that reads out an ontology and converts it into
test cases, needs further description of test cases and their execution.
dhiller pushed a commit to wk-muenster/RDFUnit that referenced this issue Sep 22, 2015
dhiller pushed a commit to wk-muenster/RDFUnit that referenced this issue Sep 22, 2015
Created first implementation of test case invocation, not called though
dhiller pushed a commit to wk-muenster/RDFUnit that referenced this issue Sep 22, 2015
First version of tests run, needs optimization of ontology retrieval
dhiller pushed a commit to wk-muenster/RDFUnit that referenced this issue Sep 22, 2015
Optimization - Single model creation for ontology
dhiller pushed a commit to wk-muenster/RDFUnit that referenced this issue Sep 22, 2015
Optimization - Create input model only once
dhiller pushed a commit to wk-muenster/RDFUnit that referenced this issue Sep 22, 2015
Minor refactoring: cleaned up call mess
dhiller pushed a commit to wk-muenster/RDFUnit that referenced this issue Sep 22, 2015
Changed example test to being executed via Request, and then checking
whether there are failed and succeeded tests.
dhiller pushed a commit to wk-muenster/RDFUnit that referenced this issue Sep 22, 2015
Updated test description to include input model method name and
test uri.
dhiller pushed a commit to wk-muenster/RDFUnit that referenced this issue Sep 22, 2015
Added resources to test failure description.
dhiller pushed a commit to wk-muenster/RDFUnit that referenced this issue Sep 22, 2015
Extracted RLOGStatement to own class.
dhiller pushed a commit to wk-muenster/RDFUnit that referenced this issue Sep 22, 2015
Controlled vocabulary integration.
pepperbob pushed a commit to wk-muenster/RDFUnit that referenced this issue Sep 23, 2015
clean code / PR issues
dhiller pushed a commit to wk-muenster/RDFUnit that referenced this issue Sep 23, 2015
- Removed unnecessary setPrefix()
- Changed from "file:" uri to no extension to use resource mechanism
dhiller pushed a commit to wk-muenster/RDFUnit that referenced this issue Sep 23, 2015
- Moved TestSource building to test case generation
- Need to remove the unnecessary parameters from test case wrapper
dhiller pushed a commit to wk-muenster/RDFUnit that referenced this issue Sep 23, 2015
Removed not needed SchemaSource from test case wrapper
dhiller pushed a commit to wk-muenster/RDFUnit that referenced this issue Sep 23, 2015
- Renamed @InputModel to @TestInput as return type will be changed from Model
  to RdfReader
- Renamed @Ontology to @Schema to express more broad validation sources
dhiller pushed a commit to wk-muenster/RDFUnit that referenced this issue Sep 23, 2015
Extracted InitializationSupport to reduce duplicate code on
initialization checks.
dhiller pushed a commit to wk-muenster/RDFUnit that referenced this issue Sep 23, 2015
Fixed method and variable naming after renaming to "TestInput"
dhiller pushed a commit to wk-muenster/RDFUnit that referenced this issue Sep 23, 2015
- Changed @TestInput return type from Model to RDFReader
- Changed @COntrolledVocabulary return type from Model to RDFReader
dhiller pushed a commit to wk-muenster/RDFUnit that referenced this issue Sep 23, 2015
- Reverted accidental format change
dhiller pushed a commit to wk-muenster/RDFUnit that referenced this issue Sep 23, 2015
Changed boolean value expression by extracting method
dhiller pushed a commit to wk-muenster/RDFUnit that referenced this issue Sep 23, 2015
pepperbob pushed a commit to wk-muenster/RDFUnit that referenced this issue Sep 23, 2015
add Readme
add test for @BeforeClass and @afterclass
pepperbob pushed a commit to wk-muenster/RDFUnit that referenced this issue Sep 23, 2015
rename @ControlledVocabulary to @AdditionalData
pepperbob pushed a commit to wk-muenster/RDFUnit that referenced this issue Sep 23, 2015
Run initial test validation through collectInitializationErrors
as more validation is up to come and needs separation from
setup code.

Maybe we should use dedicated Validators.
@dhiller
Copy link
Contributor

dhiller commented Sep 24, 2015

I think we can close this issue now :)

@jimkont jimkont closed this as completed Sep 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants