Unit Testing

1 view
Skip to first unread message

KushalP

unread,
Jun 23, 2010, 12:29:35 PM6/23/10
to athena-discuss
Out of curiosity, how do you want to implement unit testing going
forwards? I figured that I would make that my first bit of code for
the project, after you set up your pom.xml for Maven how you'd like it.

Ian Clarke

unread,
Jun 23, 2010, 12:36:11 PM6/23/10
to athena-...@googlegroups.com
Well, I just think the standard Maven project structure, with src/main/java and src/test/java directories, no need for anything fancy.  Would you like to set that up or shall I?

Then I typically prefer to use TestNG for unit testing, rather than JUnit.

Ian.
--
Ian Clarke
CEO, SenseArray
Email: i...@sensearray.com
Ph: +1 512 422 3588

Kushal Pisavadia

unread,
Jun 23, 2010, 12:41:17 PM6/23/10
to athena-...@googlegroups.com
I'll let you set everything up how you like it, as it's a redefinition of where the project stands.

Then I'll set up a minimum NetBeans config for anyone using the other IDE to get started on.

I'm fine with both TestNG and JUnit and have no preference.

Kind Regards,

Kushal Pisavadia
E: kus...@gmail.com

Ian Clarke

unread,
Jun 23, 2010, 1:00:57 PM6/23/10
to athena-...@googlegroups.com
Ok, np.

Ian.

Ian Clarke

unread,
Jun 23, 2010, 1:09:01 PM6/23/10
to athena-...@googlegroups.com
Done, please let me know if it works.

Ian.

Kushal Pisavadia

unread,
Jun 23, 2010, 1:21:51 PM6/23/10
to athena-...@googlegroups.com
Everything works perfectly. Now all that's needed is for the test/src files to be separated out and the project is good to go!
 
Kind Regards,

Kushal Pisavadia
E: kus...@gmail.com


Ian Clarke

unread,
Jun 23, 2010, 1:22:31 PM6/23/10
to athena-...@googlegroups.com
That should be done now, I think.  I moved Test1 into that directory and converted it into a unit test.

Ian.

Kushal Pisavadia

unread,
Jun 23, 2010, 1:39:01 PM6/23/10
to athena-...@googlegroups.com
Everything works perfectly. Just cleaned up the pom.xml as I'm a little OCD.

Kind Regards,

Kushal Pisavadia
E: kus...@gmail.com


Ian Clarke

unread,
Jun 23, 2010, 1:42:37 PM6/23/10
to athena-...@googlegroups.com
No problem, pulled.

I've also started adding a few issues.

Ian.

Kushal Pisavadia

unread,
Jun 23, 2010, 6:13:12 PM6/23/10
to athena-...@googlegroups.com
Does that test run for you when doing "mvn test" ?

For me it seems to fail miserably. Did it ever work? Here's the trace:

-------------------------------------------------------------------------------
Test set: TestSuite
-------------------------------------------------------------------------------
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 19.079 sec <<< FAILURE!
simpleIntegrityTest(athena.TestIntegrity)  Time elapsed: 0.369 sec  <<< FAILURE!
java.lang.NullPointerException
        at athena.Query$Contains.match(Query.java:218)
        at athena.Query$And.match(Query.java:178)
        at athena.StoreIterator.computeNext(StoreIterator.java:115)
        at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:136)
        at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:131)
        at com.google.common.collect.Iterators.size(Iterators.java:125)
        at com.google.common.collect.Iterables.size(Iterables.java:76)
        at athena.TestIntegrity.search(TestIntegrity.java:20)
        at athena.TestIntegrity.simpleIntegrityTest(TestIntegrity.java:46)

I'm heading off to bed now, but will put this here in case you want to have a go.

Kind Regards,

Kushal Pisavadia
E: kus...@gmail.com


Ian Clarke

unread,
Jun 23, 2010, 6:25:24 PM6/23/10
to athena-...@googlegroups.com
My bad, fixed now.

Ian.
Reply all
Reply to author
Forward
0 new messages