You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Roger Kitain <Ro...@Sun.COM> on 2010/01/12 22:48:07 UTC

OSGI Testing

Kind of a newbie question..
We use GlassFish V3 which is OSGI (felix) based (there are a number of 
OSGI modules running when the server is started).
I would like to write some tests to test the validity of OSGI bundles 
deployed to GlassFish V3.  Can I do this - or, s the test framework
expecting to launch its own felix instance?

thanks.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: OSGI Testing

Posted by teemu kanstren <tk...@gmail.com>.
Do I understand correctly that you want to do some testing on components
deployed on a real OSGI container?

For this you can use one of the existing testing tools (junit4osgi and pax
were mentioned). But I found them a bit too much for my simplistic testing
habits. So I start Felix from my tests, autodeploy my bundles and then use
reflection to run some tests from a specific test bundle. Sounds complicated
but not that hard. Don't know how hard it would be for you to change Felix
to GlassFish (GF) here since I know nothing about GF. Of course I am sure
these OSGI test tools give some great features I know nothing about.. :)

I guess its about personal preferences and needs.

Teemu

2010/1/12 Roger Kitain <Ro...@sun.com>

> Kind of a newbie question..
> We use GlassFish V3 which is OSGI (felix) based (there are a number of OSGI
> modules running when the server is started).
> I would like to write some tests to test the validity of OSGI bundles
> deployed to GlassFish V3.  Can I do this - or, s the test framework
> expecting to launch its own felix instance?
>
> thanks.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>

Re: Simple Unit testing.

Posted by Guillaume Nodet <gn...@gmail.com>.
Sounds good.  There's huge difference between unit testing and integration
testing.  PaxExam is really suited for integration testing.

On Thu, Jun 10, 2010 at 08:37, peter lawrey <pe...@edgeci.com> wrote:

> Hello Guillaume,
>  At present my tests are simple, so I was able to use JMock to mock out
> the work the OSGi/iPOJO container would do.
>  However, as I have more complex tests I will try PaxExam.
>
> Thank you,
>   Peter.
>
> -----Original Message-----
> From: Guillaume Nodet [mailto:gnodet@gmail.com]
> Sent: 09 June 2010 17:19
> To: users@felix.apache.org
> Subject: Re: Simple Unit testing.
>
> Have a look at pax-exam: http://wiki.ops4j.org/display/paxexam/Pax+Exam
> This is for integration tests in OSGi, so i would not really call it
> simple
> either, mostly because you need to configure your OSGi environment, but
> it
> can be done quite easily if you write your own abstract test class which
> would do that.
>
> On Wed, Jun 9, 2010 at 17:40, peter lawrey <pe...@edgeci.com>
> wrote:
>
> > Hello,
> >
> > I have read the tutorial
> >
> http://felix.apache.org/site/apache-felix-ipojo-junit4osgi-tutorial.html
> > but I didn't find it simple at all.
> >
> > Currently when I run a unit test, in my IDE I can select a single unit
> > test, a test case or a package and I select Run -> Tests.  If I want
> to
> > debug my test, I select Debug -> Tests.
> >
> > That's what I call simple.
> >
> > When I have worked with frameworks in the past, I had to add a few
> > things in the setUp() and tearDown() or extend a custom abstract
> > TestCase which did this for me, but after that the unit test ran
> > normally, in my IDE and in maven.
> >
> > Has anyone done this with OSGi/iPOJO components?
> >
> > Regards,
> >  Peter.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> > For additional commands, e-mail: users-help@felix.apache.org
> >
> >
>
>
> --
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> ------------------------
> Open Source SOA
> http://fusesource.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com

RE: Simple Unit testing.

Posted by peter lawrey <pe...@edgeci.com>.
Hello Guillaume,
  At present my tests are simple, so I was able to use JMock to mock out
the work the OSGi/iPOJO container would do.
  However, as I have more complex tests I will try PaxExam.

Thank you,
  Peter.

-----Original Message-----
From: Guillaume Nodet [mailto:gnodet@gmail.com] 
Sent: 09 June 2010 17:19
To: users@felix.apache.org
Subject: Re: Simple Unit testing.

Have a look at pax-exam: http://wiki.ops4j.org/display/paxexam/Pax+Exam
This is for integration tests in OSGi, so i would not really call it
simple
either, mostly because you need to configure your OSGi environment, but
it
can be done quite easily if you write your own abstract test class which
would do that.

On Wed, Jun 9, 2010 at 17:40, peter lawrey <pe...@edgeci.com>
wrote:

> Hello,
>
> I have read the tutorial
>
http://felix.apache.org/site/apache-felix-ipojo-junit4osgi-tutorial.html
> but I didn't find it simple at all.
>
> Currently when I run a unit test, in my IDE I can select a single unit
> test, a test case or a package and I select Run -> Tests.  If I want
to
> debug my test, I select Debug -> Tests.
>
> That's what I call simple.
>
> When I have worked with frameworks in the past, I had to add a few
> things in the setUp() and tearDown() or extend a custom abstract
> TestCase which did this for me, but after that the unit test ran
> normally, in my IDE and in maven.
>
> Has anyone done this with OSGi/iPOJO components?
>
> Regards,
>  Peter.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Simple Unit testing.

Posted by Guillaume Nodet <gn...@gmail.com>.
Have a look at pax-exam: http://wiki.ops4j.org/display/paxexam/Pax+Exam
This is for integration tests in OSGi, so i would not really call it simple
either, mostly because you need to configure your OSGi environment, but it
can be done quite easily if you write your own abstract test class which
would do that.

On Wed, Jun 9, 2010 at 17:40, peter lawrey <pe...@edgeci.com> wrote:

> Hello,
>
> I have read the tutorial
> http://felix.apache.org/site/apache-felix-ipojo-junit4osgi-tutorial.html
> but I didn't find it simple at all.
>
> Currently when I run a unit test, in my IDE I can select a single unit
> test, a test case or a package and I select Run -> Tests.  If I want to
> debug my test, I select Debug -> Tests.
>
> That's what I call simple.
>
> When I have worked with frameworks in the past, I had to add a few
> things in the setUp() and tearDown() or extend a custom abstract
> TestCase which did this for me, but after that the unit test ran
> normally, in my IDE and in maven.
>
> Has anyone done this with OSGi/iPOJO components?
>
> Regards,
>  Peter.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com

Simple Unit testing.

Posted by peter lawrey <pe...@edgeci.com>.
Hello,

I have read the tutorial
http://felix.apache.org/site/apache-felix-ipojo-junit4osgi-tutorial.html
but I didn't find it simple at all.

Currently when I run a unit test, in my IDE I can select a single unit
test, a test case or a package and I select Run -> Tests.  If I want to
debug my test, I select Debug -> Tests. 

That's what I call simple.

When I have worked with frameworks in the past, I had to add a few
things in the setUp() and tearDown() or extend a custom abstract
TestCase which did this for me, but after that the unit test ran
normally, in my IDE and in maven.

Has anyone done this with OSGi/iPOJO components?

Regards,
  Peter.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: OSGI Testing

Posted by Kris Pruden <kp...@gmail.com>.
There are two options (that I know of) for running automated tests  
inside an OSGi container:

junit4osgi: http://felix.apache.org/site/apache-felix-ipojo-junit4osgi.html
pax:exam: http://wiki.ops4j.org/display/paxexam/Pax+Exam

Each have their pros and cons.  junit4osgi is the simpler/easier of  
the two, but only supports the felix framework (afaik) and doesn't  
support some more advanced OSGi features like extension bundles (or at  
least it didn't the last time I tried it).  Also, it only supports  
writing your tests using JUnit3, and once you get those JUnit4 you  
never want to go back :)

Pax:exam on the other had is quite flexible and powerful.  It supports  
all the major OSGi frameworks, and I haven't found an OSGi  
configuration it couldn't support.  On the other hand it is very  
complex, and the documentation is a bit sketchy.  When it's working  
it's awesome, when it doesn't work it can be infuriating.

Both have maven plugins that make running the tests from maven a cinch.

FWIW I'm using pax:exam, primarily because I need the flexibility and  
extension bundle support.

Kris


On Jan 12, 2010, at 1:48 PM, Roger Kitain wrote:

> Kind of a newbie question..
> We use GlassFish V3 which is OSGI (felix) based (there are a number  
> of OSGI modules running when the server is started).
> I would like to write some tests to test the validity of OSGI  
> bundles deployed to GlassFish V3.  Can I do this - or, s the test  
> framework
> expecting to launch its own felix instance?
>
> thanks.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org