Вопрос

We're using paxexam 3.3.0 to test bundles running in Karaf 3.0.0 utilizing karafDistributionConfiguration() to deploy feature files. A typical usecase looks like:

Bundle 1 -- REST http service
Bundle 2 -- Service implementation calling external API
Bundle 3 -- Service implementation saving transaction record to DB
Bundle 4 -- Interfaces
Bundle 5 -- Data source

My question: Are there clear conventions for where paxexam integration test cases should reside? Should paxexam tests always live in a separate maven project? This certainly makes sense for a "full" integration test where several bundles are involved in a single test.

On the other hand, it might make sense to have simple, single-bundle integration tests as part of each maven project so that when I execute a build on a single project/bundle, I have the option of including integration tests specific to that bundle.

Thoughts? Or Gotchas I might run into down the line?

Это было полезно?

Решение

We are also using both options in Apache Sling, here's an example of each:

Pax Exam tests in a separate bundle:

https://svn.apache.org/repos/asf/sling/trunk/installer/it

Pax Exam tests in the same bundle, using a bundle.file.name system property, set in the POM, to allow the tests to find the bundle that was just built:

https://svn.apache.org/repos/asf/sling/trunk/bundles/scripting/core - see the BindingsValuesProvidersByContextIT.java class.

I agree that both options are valid depending on how "big" the tests are and whether they test a single bundle or a combination of bundles.

Naming the tests classes with an IT suffix causes them to be executed by the failsafe plugin in the integration-tests phases, instead of surefire in the test phase.

Другие советы

Well, Pax Exam is designed for integration tests, therefore it's best practice to keep the Integration tests separated from the sources in a test-module. But it is possible to also use Pax-Exam in the same bundle, needs some extra tweeking though. You'll find a working sample in my blog and gihub project.
The specialties are about adding the classes which need testing into the pax-exam test-container, cause usually the bundle of the same project isn't existing yet.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top