Skip to content
Simon Templer edited this page Jan 5, 2017 · 6 revisions

Tests are implemented using JUnit. Tests for classes in a bundle are not added to the bundle itself, but to a separate bundle for fragment that adds the suffix .test to the name of the original bundle.

Names of test classes by convention end with Test, or with IT if they are integration tests.

Test bundles/fragments need to be added to the Tests.product. Make sure the product validates.

To run all tests the simplest way is to run the Tests product from within Eclipse. To run single test classes or methods, you can right click them in Eclipse and select Run As → JUnit Plug-in Test

If you want to run only certain tests in the test product use the -class <pattern> argument. The pattern allows * as a simple wild card.

Allure

The Allure test framework can be used to augment tests with additional information like file attachments, categorisation in Features and Stories and partitioning into steps.

Generation of Allure test report files is currently only supported when running tests via the Tests product.

To use Allure features you have to annotate your code with Allure annotations. To that purpose, add the package ru.yandex.qatools.allure.annotations to the imported packages in your bundle.

To support @Step, @Attachment and @Parameter annotations AspectJ support is required. AspectJ is configured in the test product using Equinox Weaving, but additionally you need specific imports in your test bundle:

org.aspectj.lang
org.aspectj.runtime.reflect
ru.yandex.qatools.allure.aspects;apply-aspects:=true

Note the apply-aspects section. This informs Equinox Weaving that we want the aspects applied to our bundle. Together with the version information, the complete imports related to Allure in the test bundle then might look like this:

 org.aspectj.lang;version="1.8.3",
 org.aspectj.runtime.reflect;version="1.8.3",
 ru.yandex.qatools.allure.annotations;version="1.5.0",
 ru.yandex.qatools.allure.aspects;version="1.5.0";apply-aspects:=true
Clone this wiki locally