Home » Archived » Buckminster » How to organize JUnit tests for running with Buckminster
How to organize JUnit tests for running with Buckminster [message #775220] |
Thu, 05 January 2012 15:22 |
Matthew Webber Messages: 198 Registered: December 2010 |
Senior Member |
|
|
We currently run our JUnit tests using Ant. I'd like to replace this with the Buckminster junit command, but I can't create a suitable launch configuration.
Currently, we use this ant:
<junit dir="@{dir}">
<classpath>
manually maintained in sync with the plugin dependencies
</classpath>
<batchtest todir="@{report.dir}">
<fileset dir="${GDA-plugin.basedir}/test">
<include name="**/*Test.java" />
<exclude name="**/*PluginTest.java" />
</fileset>
</batchtest>
</junit>
The nice thing about this arrangement is that when our developers add a new test, it gets automatically run provided that class name ends in Test.
I want to do the same thing using the Buckminster junit command, but it requires a suitable .launch configuration. It looks like Eclipse launch configurations can only run either a single test, or all the tests in a project, package or source folder. There doesn't seem to be any other way of selecting tests. In particular, I can't discriminate between JUnit and JUnit Plugin tests.
There are lots of good reasons to use Buckminster to run my JUnit tests:
(1) I don't need to maintain a separate test classpath, since Eclipse/Buckminster understands the plugin dependencies
(2) The infrastructure used to run tests is the same in the IDE and in the batch test environment
But I'm stuck, seemingly due to the inflexibility of launch configurations. So, how do the rest of you do this? I'd really like to keep the automatic test discovery that we currently have.
We use JUnit 4 exclusively. We don't use test suites to define the tests to run, just the *Test.java pattern.
Thanks for any suggestions.
Matthew
|
|
|
Re: How to organize JUnit tests for running with Buckminster [message #775350 is a reply to message #775220] |
Thu, 05 January 2012 20:24 |
|
Hi Matthew,
I understand your dilemma and I agree it would be great to have a
mechanism whereby tests could be automatically detected and added. As
you've discovered, the launch configuration offers no such flexibility
which leaves us with two options.
1. Buckminster adds a more flexible launch command that can detect
launch configurations using some ant-linke pattern and then execute them
all.
2. You execute a JUnit test which in turn performs some discovery. I
don't think that should be too hard actually, especially if you're doing
this in the OSGi domain. A developer that provides a test would simply
add it as an OSGi service and then the JUnit test launched by the
Buckminster launcher would run all such services.
You will need two bundles in order to make this happen. They are fairly
common so chances are you already have them:
org.eclipse.equinox.ds
org.eclipse.equinox.util
For more info about how to add declarative services I can recommend
reading this article:
http://www.vogella.de/articles/OSGi/ar01s07.html
HTH,
Thomas Hallgren
On 2012-01-05 16:22, Matthew Webber wrote:
> We currently run our JUnit tests using Ant. I'd like to replace this
> with the Buckminster junit command, but I can't create a suitable launch
> configuration.
>
> Currently, we use this ant:
> <junit dir="@{dir}">
> <classpath>
> manually maintained in sync with the plugin dependencies
> </classpath>
> <batchtest todir="@{report.dir}">
> <fileset dir="${GDA-plugin.basedir}/test">
> <include name="**/*Test.java" />
> <exclude name="**/*PluginTest.java" />
> </fileset>
> </batchtest>
> </junit>
> The nice thing about this arrangement is that when our developers add a
> new test, it gets automatically run provided that class name ends in Test.
>
> I want to do the same thing using the Buckminster junit command, but it
> requires a suitable .launch configuration. It looks like Eclipse launch
> configurations can only run either a single test, or all the tests in a
> project, package or source folder. There doesn't seem to be any other
> way of selecting tests. In particular, I can't discriminate between
> JUnit and JUnit Plugin tests.
>
> There are lots of good reasons to use Buckminster to run my JUnit tests:
> (1) I don't need to maintain a separate test classpath, since
> Eclipse/Buckminster understands the plugin dependencies
> (2) The infrastructure used to run tests is the same in the IDE and in
> the batch test environment
>
> But I'm stuck, seemingly due to the inflexibility of launch
> configurations. So, how do the rest of you do this? I'd really like to
> keep the automatic test discovery that we currently have.
>
> We use JUnit 4 exclusively. We don't use test suites to define the tests
> to run, just the *Test.java pattern.
>
> Thanks for any suggestions.
> Matthew
>
>
>
>
|
|
| |
Re: How to organize JUnit tests for running with Buckminster [message #883883 is a reply to message #775220] |
Sat, 09 June 2012 17:03 |
|
On 01/05/2012 04:22 PM, Matthew Webber wrote:
> I want to do the same thing using the Buckminster junit command, but it
> requires a suitable .launch configuration. It looks like Eclipse launch
> configurations can only run either a single test, or all the tests in a
> project, package or source folder. There doesn't seem to be any other
> way of selecting tests. In particular, I can't discriminate between
> JUnit and JUnit Plugin tests.
Hi
probably I'm missing something but I usually create a test suite for all
my junit tests and one for all my junit plugin tests. For the junit
plugin tests suite I create from Eclipse a junit plugin launch
configuration based on a single test feature, and this works fine when
run from Buckminster...
cheers
Lorenzo
--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net
HOME: http://www.lorenzobettini.it
TDD Book: https://leanpub.com/tdd-buildautomation-ci
Xtext Book: https://www.packtpub.com/application-development/implementing-domain-specific-languages-xtext-and-xtend-second-edition
|
|
| |
Goto Forum:
Current Time: Thu Mar 28 15:41:57 GMT 2024
Powered by FUDForum. Page generated in 0.02607 seconds
|