You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by Mike Grove <mi...@clarkparsia.com> on 2013/09/03 01:47:03 UTC

Re: test cases

On Sat, Aug 31, 2013 at 2:41 AM, Claude Warren <cl...@xenei.com> wrote:

> My strategy for building the new Junit 4.11 tests is:
>
>    1. Tag the source tree and check it out.
>    2. Migrate all tests from Junit 3.x to 4.11 while moving them to
>    packages that match the packages of the class under test.
>    3. For interfaces the tests must take a parameter so that implementers
>    can easily run/extended the standard tests against their implementation.
>    4. For complex interfaces (e.g. ones that return other interfaces
>    defined in Jena) test suites must be constructed that will test all of
> the
>    returned interface.
>    5. Reuse the classes implemented for testing where appropriate
>    (e.g. com.hp.hpl.jena.graph.RecordingListener)
>    6. Mock classes for which a testing implementation does not currently
>    exist where required. (e.g. the mock TransactionHandler above).
>    7. Diff tag and current trunk (assuming that new tests have been added)
>    8. Add new tests to account for the diff.
>    9. Repeat 7 through 9 until there are no changes.
>    10. Work with development team to ensure orderly transition to new
> tests.
>    11. possibly redo steps 7 through 9 to account for any possibly missed
>    changes.
>    12. Document how to extend the classes to make life easier for
>    implementers.
>

I can be the guinea pig on this as this is something we're interested in.

Cheers,

Mike


>
> I have not tagged the source tree yet and am looking through the existing
> tests to ensure that I understand how to convert the patterns that have
> been used to the 4.11 version.
>
> I have some code that I have not yet checked in to the new test branch.
>
> Claude
>
>
>
> On Fri, Aug 30, 2013 at 5:39 PM, Andy Seaborne <an...@apache.org> wrote:
>
> > On 30/08/13 17:04, Claude Warren wrote:
> >
> >> In the above case (from the graph testing suite):
> >>
> >>
> >> TransactionHandler th = Mockito.mock( TransactionHandler.class );
> >> Graph g = Factory.**createGraphMemWithTransactionH**andler(th);
> >> Assert.assertEquals( th, g.getTransactionHandler() );
> >>
> >>
> > Claude,
> >
> > I was asking for a wider overview of what is your proposed testing
> > strategy.
> >
> > But I do not understand what you are talking about here - do you mean
> some
> > new work you have or the jena-core test suite? There is no call to
> > createGraphMemWithTransactionH**andler I can find in the graph testing in
> > jena-core or in Experimental/new-test.
> >
> > I am just trying to understand what mocking facilities here.
> >
> >         Andy
> >
> >
> >>
> >> On Fri, Aug 30, 2013 at 4:50 PM, Andy Seaborne <an...@apache.org> wrote:
> >>
> >>  Claude,
> >>>
> >>> I don't understand what is being mocked. Could you explain a bit about
> >>> the
> >>> intention/design you have for the testing.  I guess I'm lacking
> context.
> >>>
> >>>          Andy
> >>>
> >>>
> >>>
> >>> On 30/08/13 16:37, Stephen Allen wrote:
> >>>
> >>>  I'm a big fan of Mockito, so I'd like to see it added.
> >>>>
> >>>> -Stephen
> >>>>
> >>>> On Thu, Aug 29, 2013 at 1:38 PM, Claude Warren <cl...@xenei.com>
> >>>> wrote:
> >>>>
> >>>>  I am rewriting the test cases for JUnit 4.x (4.11 currently) and am
> >>>>> thinking about adding Mockito to mock some of the objects in the
> tests.
> >>>>>    For example testing that
> >>>>>
> >>>>> Graph g = Factory.****createGraphMemWithTransactionH****andler(th);
> >>>>>
> >>>>>       g.getTransactionHandler();
> >>>>> returns the same transaction handler.
> >>>>>
> >>>>> Does anyone have a problem with adding Mockito the the test build?
> >>>>>
> >>>>> --
> >>>>> I like: Like Like - The likeliest place on the web<
> >>>>> http://like-like.xenei.com**>
> >>>>> Identity: https://www.identify.nu/user.****php?claude@xenei.com<
> https://www.identify.nu/user.**php?claude@xenei.com>
> >>>>> <https://**www.identify.nu/user.php?**claude@xenei.com<
> https://www.identify.nu/user.php?claude@xenei.com>
> >>>>> >
> >>>>> LinkedIn: http://www.linkedin.com/in/****claudewarren<
> http://www.linkedin.com/in/**claudewarren>
> >>>>> <http://www.**linkedin.com/in/claudewarren<
> http://www.linkedin.com/in/claudewarren>
> >>>>> >
> >>>>>
> >>>>>
> >>>>
> >>>
> >>
> >>
> >
>
>
> --
> I like: Like Like - The likeliest place on the web<
> http://like-like.xenei.com>
> Identity: https://www.identify.nu/user.php?claude@xenei.com
> LinkedIn: http://www.linkedin.com/in/claudewarren
>

Re: test cases

Posted by Claude Warren <cl...@xenei.com>.
I have added a tag "new-test-core-graph-mem that contains the new tests for
the core graph and mem directories.  This includes the new structure which
is described in the  javadoc for the testing_framework package
(package-info.java)

I have attempted to put all the contract tests the abstract tests, and
implementation specific tests in the concrete implementations.

see jena.mem.GraphMemSuite for an example of the implementation of the
entire graph suite test.
see jena.mem.GraphMemTest for an example of an implementation specific
graph test.

Graph implementers should, at a minimum, implement AbstractGraphSuite.

Please let me know if you find any issues.

Claude


On Tue, Sep 3, 2013 at 12:47 AM, Mike Grove <mi...@clarkparsia.com> wrote:

> On Sat, Aug 31, 2013 at 2:41 AM, Claude Warren <cl...@xenei.com> wrote:
>
> > My strategy for building the new Junit 4.11 tests is:
> >
> >    1. Tag the source tree and check it out.
> >    2. Migrate all tests from Junit 3.x to 4.11 while moving them to
> >    packages that match the packages of the class under test.
> >    3. For interfaces the tests must take a parameter so that implementers
> >    can easily run/extended the standard tests against their
> implementation.
> >    4. For complex interfaces (e.g. ones that return other interfaces
> >    defined in Jena) test suites must be constructed that will test all of
> > the
> >    returned interface.
> >    5. Reuse the classes implemented for testing where appropriate
> >    (e.g. com.hp.hpl.jena.graph.RecordingListener)
> >    6. Mock classes for which a testing implementation does not currently
> >    exist where required. (e.g. the mock TransactionHandler above).
> >    7. Diff tag and current trunk (assuming that new tests have been
> added)
> >    8. Add new tests to account for the diff.
> >    9. Repeat 7 through 9 until there are no changes.
> >    10. Work with development team to ensure orderly transition to new
> > tests.
> >    11. possibly redo steps 7 through 9 to account for any possibly missed
> >    changes.
> >    12. Document how to extend the classes to make life easier for
> >    implementers.
> >
>
> I can be the guinea pig on this as this is something we're interested in.
>
> Cheers,
>
> Mike
>
>
> >
> > I have not tagged the source tree yet and am looking through the existing
> > tests to ensure that I understand how to convert the patterns that have
> > been used to the 4.11 version.
> >
> > I have some code that I have not yet checked in to the new test branch.
> >
> > Claude
> >
> >
> >
> > On Fri, Aug 30, 2013 at 5:39 PM, Andy Seaborne <an...@apache.org> wrote:
> >
> > > On 30/08/13 17:04, Claude Warren wrote:
> > >
> > >> In the above case (from the graph testing suite):
> > >>
> > >>
> > >> TransactionHandler th = Mockito.mock( TransactionHandler.class );
> > >> Graph g = Factory.**createGraphMemWithTransactionH**andler(th);
> > >> Assert.assertEquals( th, g.getTransactionHandler() );
> > >>
> > >>
> > > Claude,
> > >
> > > I was asking for a wider overview of what is your proposed testing
> > > strategy.
> > >
> > > But I do not understand what you are talking about here - do you mean
> > some
> > > new work you have or the jena-core test suite? There is no call to
> > > createGraphMemWithTransactionH**andler I can find in the graph testing
> in
> > > jena-core or in Experimental/new-test.
> > >
> > > I am just trying to understand what mocking facilities here.
> > >
> > >         Andy
> > >
> > >
> > >>
> > >> On Fri, Aug 30, 2013 at 4:50 PM, Andy Seaborne <an...@apache.org>
> wrote:
> > >>
> > >>  Claude,
> > >>>
> > >>> I don't understand what is being mocked. Could you explain a bit
> about
> > >>> the
> > >>> intention/design you have for the testing.  I guess I'm lacking
> > context.
> > >>>
> > >>>          Andy
> > >>>
> > >>>
> > >>>
> > >>> On 30/08/13 16:37, Stephen Allen wrote:
> > >>>
> > >>>  I'm a big fan of Mockito, so I'd like to see it added.
> > >>>>
> > >>>> -Stephen
> > >>>>
> > >>>> On Thu, Aug 29, 2013 at 1:38 PM, Claude Warren <cl...@xenei.com>
> > >>>> wrote:
> > >>>>
> > >>>>  I am rewriting the test cases for JUnit 4.x (4.11 currently) and am
> > >>>>> thinking about adding Mockito to mock some of the objects in the
> > tests.
> > >>>>>    For example testing that
> > >>>>>
> > >>>>> Graph g = Factory.****createGraphMemWithTransactionH****andler(th);
> > >>>>>
> > >>>>>       g.getTransactionHandler();
> > >>>>> returns the same transaction handler.
> > >>>>>
> > >>>>> Does anyone have a problem with adding Mockito the the test build?
> > >>>>>
> > >>>>> --
> > >>>>> I like: Like Like - The likeliest place on the web<
> > >>>>> http://like-like.xenei.com**>
> > >>>>> Identity: https://www.identify.nu/user.****php?claude@xenei.com<
> > https://www.identify.nu/user.**php?claude@xenei.com>
> > >>>>> <https://**www.identify.nu/user.php?**claude@xenei.com<
> > https://www.identify.nu/user.php?claude@xenei.com>
> > >>>>> >
> > >>>>> LinkedIn: http://www.linkedin.com/in/****claudewarren<
> > http://www.linkedin.com/in/**claudewarren>
> > >>>>> <http://www.**linkedin.com/in/claudewarren<
> > http://www.linkedin.com/in/claudewarren>
> > >>>>> >
> > >>>>>
> > >>>>>
> > >>>>
> > >>>
> > >>
> > >>
> > >
> >
> >
> > --
> > I like: Like Like - The likeliest place on the web<
> > http://like-like.xenei.com>
> > Identity: https://www.identify.nu/user.php?claude@xenei.com
> > LinkedIn: http://www.linkedin.com/in/claudewarren
> >
>



-- 
I like: Like Like - The likeliest place on the web<http://like-like.xenei.com>
LinkedIn: http://www.linkedin.com/in/claudewarren