Unit testing as part of CI with Tycho

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Unit testing as part of CI with Tycho

DanPollitt
We have recently started using Tycho (0.10.0) and are investigating best practices for automated unit testing in CI (Hudson/Jenkins) builds.  This raises a number of questions:

1. Is it recommended to package unit tests in a separate test fragment, or to include them in the main bundle under a separate source root?

2. If using a test fragment, how should CI jobs be set up to ensure that deployment of the host bundle is dependent on unit test success?

3. Is it possible to create separate jobs in Jenkins for the host bundle and the test fragment and have the dependency between the jobs be derived automatically from the Fragment-Host entry in the fragment manifest?

4. Would it be necessary to use the integration-test Maven goal to run unit tests in a test fragment?

Hope you can help,
Dan
Reply | Threaded
Open this post in threaded view
|

Re: Unit testing as part of CI with Tycho

Igor Fedorenko-2
see my comments inline

--
Regards,
Igor

On Mon, Mar 7, 2011 at 9:54 AM, DanPollitt <[hidden email]> wrote:
> We have recently started using Tycho (0.10.0) and are investigating best
> practices for automated unit testing in CI (Hudson/Jenkins) builds.  This
> raises a number of questions:
>
> 1. Is it recommended to package unit tests in a separate test fragment, or
> to include them in the main bundle under a separate source root?
>

Tests must go to a separate project, both regular bundles and
fragments can be used for tests. In order to collocate tests with
production code in the same bundle, Tycho would have to manage two
separate classpaths, which is not supported by OSGi bundle manifest
format.


> 2. If using a test fragment, how should CI jobs be set up to ensure that
> deployment of the host bundle is dependent on unit test success?
>

This is not possible at the moment. Do note that this is a general
Maven problem and not specific to Tycho.

> 3. Is it possible to create separate jobs in Jenkins for the host bundle and
> the test fragment and have the dependency between the jobs be derived
> automatically from the Fragment-Host entry in the fragment manifest?
>
> 4. Would it be necessary to use the integration-test Maven goal to run unit
> tests in a test fragment?
>

You have to use maven-osgi-test-plugin integration-test goal to run
tests in OSGi runtime.


> Hope you can help,
> Dan
>
> --
Reply | Threaded
Open this post in threaded view
|

RE: Unit testing as part of CI with Tycho

Tobias Oberlies
More answers inline :-)

> (...)

> > 2. If using a test fragment, how should CI jobs be set up to ensure that
> > deployment of the host bundle is dependent on unit test success?
>
> This is not possible at the moment. Do note that this is a general
> Maven problem and not specific to Tycho.
 
A workaround for this is to run "mvn clean verify" on the reactor as first build step and "mvn clean deploy" as second step. Since Jenkins will only execute the second step if the first one succeeded, you effectively get what you want.

> > 3. Is it possible to create separate jobs in Jenkins for the host bundle
> and
> > the test fragment and have the dependency between the jobs be derived
> > automatically from the Fragment-Host entry in the fragment manifest?

As far as I know, the Maven itegration for Jenkins does not recognize the Tycho packaging types - although I've never tried this myself.

> (...)

Reply | Threaded
Open this post in threaded view
|

Re: Unit testing as part of CI with Tycho

ejain
On Thu, Mar 17, 2011 at 07:34, Oberlies, Tobias <[hidden email]> wrote:
> As far as I know, the Maven itegration for Jenkins does not recognize the Tycho packaging types - although I've never tried this myself.

Does the Maven integration on Jenkins recognize bundle dependencies?

Our current setup (using Bamboo) checks out the parent and then builds
all modules whenever something changes, but that's inefficient, and
will break down as soon as we need to maintain multiple versions of
certain features...
Reply | Threaded
Open this post in threaded view
|

Re: Unit testing as part of CI with Tycho

Jason van Zyl-2

On Mar 18, 2011, at 6:07 PM, Eric Jain wrote:

On Thu, Mar 17, 2011 at 07:34, Oberlies, Tobias <[hidden email]> wrote:
As far as I know, the Maven itegration for Jenkins does not recognize the Tycho packaging types - although I've never tried this myself.

Does the Maven integration on Jenkins recognize bundle dependencies?


I doubt this is anything Jenkins will ever do, but it's something that Hudson will.

Our current setup (using Bamboo) checks out the parent and then builds
all modules whenever something changes, but that's inefficient, and
will break down as soon as we need to maintain multiple versions of
certain features...

Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder,  Apache Maven
http://twitter.com/jvanzyl
---------------------------------------------------------

Three people can keep a secret provided two of them are dead.

 -- Unknown



Reply | Threaded
Open this post in threaded view
|

Re: Unit testing as part of CI with Tycho

ejain
On Fri, Mar 18, 2011 at 20:08, Jason van Zyl <[hidden email]> wrote:
> I doubt this is anything Jenkins will ever do, but it's something that
> Hudson will.

So I'm curious how people are currently building and managing features
(and plugins and products).

There is also the issue of mapping feature/plugin version numbers to
SCM branches/tags (handled with .map files when using PDE build).
Reply | Threaded
Open this post in threaded view
|

Re: Unit testing as part of CI with Tycho

Jason van Zyl-2

On Mar 18, 2011, at 10:44 PM, Eric Jain wrote:

On Fri, Mar 18, 2011 at 20:08, Jason van Zyl <[hidden email]> wrote:
I doubt this is anything Jenkins will ever do, but it's something that
Hudson will.

So I'm curious how people are currently building and managing features
(and plugins and products).


I imagine with great to extreme difficulty :-)

There is also the issue of mapping feature/plugin version numbers to
SCM branches/tags (handled with .map files when using PDE build).

Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder,  Apache Maven
http://twitter.com/jvanzyl
---------------------------------------------------------

Simplex sigillum veri. (Simplicity is the seal of truth.)