On 10/06/14 11:25, Claude Warren wrote:
I would like to see Jena adopt a set of contract tests. I recently wrote
an article for Dr. Dobb's [1] concerning contract testing. In it I use the
experimental/new_tests as an example.
The basic concept is we provide a set of contract tests for expected
extension points like the Graph SPI. Implementers of Graph would be able
to run the contract test to ensure that their implementations match what is
expected. To be honest, I have implemented what I thought was a proper
Graph implementation only to find that it was missing some component.
My proposal is that as we go through the process of refactoring and
building version 3 we create contract tests for the extension points. In
so doing we can more completely document what the requirement is and
provide a test for it.
Is this changes to the tests or changes to tests and things like Graph
under main/java?
I do think we need not to overload Jena3 with too many item that must be
done before first release.
For example the a Graph contract test case may be:
/* Inserting into the graph requires that the graph listener be notified of
the insertion. */
@ContractTest
public void notifyInsertion()
{ ..... }
Any thoughts or objections?
If it's better test structures then +1.
Is there anything stopping you in continuing with
https://svn.apache.org/repos/asf/jena/Experimental/new-test/
?
As it may take time, we can simply have two sets of tests for a while.
(Actually, as you have found out, we have "old" and "older" groups of
tests in core already).
Claude
[1] http://www.drdobbs.com/testing/simplifying-contract-testing/240167128
A comment about the Graph interface:
I see no point in GraphAdd and would prefer one interface.
The important difference is mutable/immutable but it is rarely fixed for
the entire lifetime of a graph in Jena and the collections style
immutable converters is better (equivalently, read-only views of a graph
or dataset).
Only if interfaces actually took "ImmutableGraph" because they needed
them would it make sense to me but that is a huge change in both code
and overall architecture.
Andy