Can't you often run itests in the same maven project as the code by using the 
failsafe plugin which runs tests after packaging is complete?

thanks
david jencks

On Aug 23, 2012, at 4:41 AM, Brian Topping wrote:

> Tim,
> 
> I'm coming in late on this and haven't read the entire thread, but we've 
> started some publicly visible integration tests with pax-exam-karaf as well, 
> you can find them at 
> http://source.marketcetera.org/root/branches/3.0.0/itests/.  I point it out 
> because it is so bare right now that it's a great place to start from.  (Note 
> this tree is a *very* fluid work-in-progress though!)
> 
> Depending on your experience level with Maven, you may ignore this pointer, 
> but note that you must set up a separate project for your tests in this 
> manner, with dependencies on the projects that you want to test as POM 
> dependencies.  This is because surefire runs before the project artifact for 
> a specific build is pushed to the repository, and of course without the 
> artifact in place, one can't test it.  This is desirable though, as it forces 
> developers to not treat the integration tests as unit tests.  The 
> dependencies, simply ensure that Maven reactor runs the itests after the 
> modules under test have successfully built.
> 
> The only issue that I've found was noted the other day, that the Karaf 
> artifacts in the maven repository are sometimes missing.  In that case, the 
> Karaf binary archive may be missing, and you'll have to build Karaf from 
> source in order for your repository to be properly populated before running 
> the tests.
> 
> Hope that helps,
> 
> Brian
> 
> 
> On Aug 23, 2012, at 1:00 PM, Ioannis Canellos <[email protected]> wrote:
> 
>> Hi Tim,
>> 
>> what pax-exam-karaf provides in addition to plain pax-exam testing, is that 
>> the test is run inside a real karaf container and you don't need to describe 
>> how you need the container itself to be provisioned.
>> 
>> On top of that, it allows you to make use of all Karaf services from inside 
>> your test, including the features service itself which make provisioning of 
>> your application inside the integration test even more easy.
>> 
>> In your test you can inject any OSGi service. You don't need to use karaf 
>> commands at all if you don't wish. But seeing how the executCommand method 
>> is implemented might help you understand how you can reuse OSGi services.
>> 
>> I have some additional links to provide with automated itests using 
>> pax-exam-karaf:
>> 
>> https://github.com/jclouds/jclouds-karaf/tree/master/itests
>> https://svn.apache.org/repos/asf/whirr/trunk/platforms/karaf/itests/
>> https://github.com/fusesource/fuse/tree/master/fabric/fabric-itests/fabric-pax-exam
>> 
>> Again, in those tests you'll see using the commands a lot, but that's more 
>> because I was trying to emulate use cases that reproduce bugs etc. Its not 
>> mandatory to do so.
>> 
>> -- 
>> Ioannis Canellos
>> FuseSource
>> 
>> Blog: http://iocanel.blogspot.com
>> Twitter: iocanel
>> 
>> 
> 

Reply via email to