-
Notifications
You must be signed in to change notification settings - Fork 5
Integration tests
Pierre T. edited this page Jan 9, 2015
·
4 revisions
To use the testing features provided by Nuun add the following dependency to your pom.
<dependency>
<groupId>io.nuun</groupId>
<artifactId>kernel-tests</artifactId>
<version>${nuunkernel.version}</version>
<scope>test</scope>
</dependency>
Integration tests in Nuun are done using the NuunITRunner
. This runner starts a Nuun kernel and bind the test class so you can inject bound class in it.
Nuun IT also provides a @WithParams
annotation which allows to pass params to the kernel.
@WithParams({Kernel.NUUN_ROOT_PACKAGE, "org.mycompany.myproject"})
@RunWith(NuunITRunner.class)
public class ServiceAIT {
@Inject
ServiceA serviceA;
@Test
public void ServiceAShouldDoSomethingUseful() {
Assertions.assertThat(serviceA).isNotNull();
serviceA.doSomethingUseful();
...
}
}
The test class is automatically bind by you may want to bind other classes for your testing needs. Nuun provides two API for that:
- The
@ITBind
annotation which can be used on a class to bind it - The
@KernelModule
annotation which is used to bind native module without having to create a plugin. This feature is only available for test purpose.
- Introduction
- ... Motivation
- ... Features
- ... Manifesto
- User manual
- ... Kernel
- ...... Kernel Life Cycle
- ...... Kernel Configuration
- ... Plugin
- ...... Plugin Life cycle
- ...... Request API
- ...... Native Module
- ...... Dependencies
- ... Tests
- ...... Integration Tests
- Advanced topics
- ... Design Best Practices
- ... Multi-Round Plugin
- ... Kernel param aliases
- ... SPI
- ...... DI Provider
- ...... Concern
- ...... Extension
- Definitions
- ... Framework
- ... Entreprise Stack
- ... API
- ... SPI
- ... Library
- ... Inversion of Control
- ... Dependency Injection
- Concepts
- ... UnitModule
- ... GlobalModule
- ... ObjectGraph