-
Notifications
You must be signed in to change notification settings - Fork 40
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
49 junit integration #51
Conversation
We should think about using a different Exception?
Created first implementation of test case invocation, not called though
First version of tests run, needs optimization of ontology retrieval
Optimization - Single model creation for ontology
Optimization - Create input model only once
Minor refactoring: cleaned up call mess
Changed example test to being executed via Request, and then checking whether there are failed and succeeded tests.
Updated test description to include input model method name and test uri.
Added resources to test failure description.
Extracted RLOGStatement to own class.
Controlled vocabulary integration.
@@ -108,7 +114,8 @@ public Builder addSchemaURI(String prefix, String schemaUri) { | |||
public Builder addLocalResource(String prefix, String localResource) { | |||
checkNotNull(localResource); | |||
|
|||
SchemaSource schemaSource = createSource(prefix, localResource, RDFReaderFactory.createResourceReader(localResource)); | |||
SchemaSource schemaSource = createSource(prefix, localResource, RDFReaderFactory.createResourceReader | |||
(localResource)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should undo changes in this file up to here as it's formatter related.
Great work Daniel & Michael!
instead of
overall, I am very happy to accept it as is and iterate over time but I see you made some comments already. Let me know when you are ready to merge |
clean code / PR issues
Collection<TestCaseResult> runTest(RdfUnitJunitTestCase rdfUnitJunitTestCase) | ||
throws IllegalAccessException, InvocationTargetException { | ||
final TestSource modelSource = new TestSourceBuilder() | ||
.setPrefixUri("custom", "rdfunit") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jimkont Could you explain what's the thing with the Prefix URI? Just noticed we just define constant / hard coded values to satifsfy the Builder.. However not sure if this is correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prefix are used as in turtle syntax (e.g. http://prefix.cc/popular.file.txt) and are meant to shorten the IRIs or as secondary (short) identifiers.
I also use them to override the actual schema IRI when I want to use a different ontology IRI than the default one
e.g. nif https://github.com/AKSW/RDFUnit/blob/master/data/schemaDecl.csv#L12 skips the default dereferencing and uses the latest version from github.
this way when the user checks against e.g. nif
the the overridden IRI is used transparently
If we use a SchemaSource
and a TestSource
directly in the tests definitions, instead of Jena Model
s, then we can reuse the prefixes defined in the constructors and avoid the hardcoded prefixes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case we cannot override anything by defining a prefix but the prefix can be used to improve the readability of the test description
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, so what would you propose regarding the setPrefixUri()
call?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To get rid off hardcoding stuff we should go with an approach similar to
@RunWith(RdfUnitJunitRunner.class)
public class ExampleTest {
@Schema
public SchemaSource schemaSource =
SchemaSourceFactory.createSchemaSourceSimple("foaf",
Constants.FOAF_ONTOLOGY_URI,
RDFReaderFactory.createResourceReader(Constants.FOAF_ONTOLOGY_URI));
@TestInput
public TestSource testSource = new TestSourceBuilder()
.setImMemSingle()
.setInMemReader(RDFReaderFactory.createResourceReader("inputmodels/foaf.rdf"))
.setReferenceSchemata(schemaSource)
.build();
}
and we can define some factory methods to simplify object construction
On Wed, Sep 23, 2015 at 12:24 PM, Daniel Hiller [email protected]
wrote:
In
rdfunit-junit/src/main/java/org/aksw/rdfunit/junit/RdfUnitJunitStatusTestExecutor.java
#51 (comment):+import org.aksw.rdfunit.sources.TestSource;
+import org.aksw.rdfunit.sources.TestSourceBuilder;
+import org.aksw.rdfunit.tests.executors.RLOGTestExecutor;
+import org.aksw.rdfunit.tests.query_generation.QueryGenerationSelectFactory;
+import org.aksw.rdfunit.tests.results.TestCaseResult;
+
+final class RdfUnitJunitStatusTestExecutor extends RLOGTestExecutor {
+
- public RdfUnitJunitStatusTestExecutor() {
super(new QueryGenerationSelectFactory());
- }
- Collection runTest(RdfUnitJunitTestCase rdfUnitJunitTestCase)
throws IllegalAccessException, InvocationTargetException {
final TestSource modelSource = new TestSourceBuilder()
.setPrefixUri("custom", "rdfunit")
OK, so what would you propose regarding the setPrefixUri() call?
—
Reply to this email directly or view it on GitHub
https://github.com/AKSW/RDFUnit/pull/51/files#r40192614.
Kontokostas Dimitris
- Removed unnecessary setPrefix() - Changed from "file:" uri to no extension to use resource mechanism
- Moved TestSource building to test case generation - Need to remove the unnecessary parameters from test case wrapper
Removed not needed SchemaSource from test case wrapper
Extracted InitializationSupport to reduce duplicate code on initialization checks.
Fixed method and variable naming after renaming to "TestInput"
- Changed @TestInput return type from Model to RDFReader - Changed @COntrolledVocabulary return type from Model to RDFReader
- Reverted accidental format change
Changed boolean value expression by extracting method
Fixed wording.
Think we've addressed most of the issues now. Regarding the "re-run failed tests" issue, I believe this won't be achievable, though :( |
@jimkont please let us know what you think :) |
BTW regarding the "run-test" issue you mentioned, I use intellij to run the internal test contained in RunnerTest$TestRunner, works fine for me. |
add Readme add test for @BeforeClass and @afterclass
To get rid off hardcoding stuff we should go with an approach similar to
and we can define some new factory methods to simplify object construction |
@Schema(uri = "ontologies/foaf.rdf") | ||
public static class TestRunner { | ||
|
||
@ControlledVocabulary |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not clear what @ControlledVocabulary
does
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it is meant to be loaded along with the data (which is what I guess from the code) should be renamed to something like @AdditionalData
but this can also be constructed directly on the @InputModel
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good Point - 'ControlledVocabulary' is just our use case (as we're loading CVs as additional data) but in general terms @AdditionalData
is more suited.
In fact it gets merged with each InputModel later, but we need to keep both separated to figure out if the offending resources found during test execution is actually part of the InputModel or not.
rename @ControlledVocabulary to @AdditionalData
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.
@jimkont Regarding your SchemaSource change proposal, we can't see how this would help as we need the RDFReader for test generation which is not exposed by the SchemaSource. Aside from the initialization error handling (which could be improved) we would propose to rather merge this pull request to prepare for a release as it covers our current use cases. We would then create an issue pulling together the remaining improvements and get back when we can spend the time again. Would that be ok for you? |
more than happy. do you want me to make a new release? |
We'd be glad if you could release this :) |
Thanks again for the amazing work! the release is ready |
Hi Dimitris,
we started implementing the Runner and so far it looks quite promising. Though we need to add some features (CVs) and improve overall performance.
Maybe you can already have a glance. Feel free to comment.
Regards,
Daniel & Michael