de.rhocas.rapit:rapit-reporting-base

rapit

License

License

MIT
Categories

Categories

Reporting Business Logic Libraries
GroupId

GroupId

de.rhocas.rapit
ArtifactId

ArtifactId

rapit-reporting-base
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

rapit
Project Organization

Project Organization

Private
Source Code Management

Source Code Management

http://github.com/nils-christian/rapit/tree/master/rapit-reporting-base

Download rapit-reporting-base

How to add to project

<!-- https://jarcasting.com/artifacts/de.rhocas.rapit/rapit-reporting-base/ -->
<dependency>
    <groupId>de.rhocas.rapit</groupId>
    <artifactId>rapit-reporting-base</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/de.rhocas.rapit/rapit-reporting-base/
implementation 'de.rhocas.rapit:rapit-reporting-base:1.0.0'
// https://jarcasting.com/artifacts/de.rhocas.rapit/rapit-reporting-base/
implementation ("de.rhocas.rapit:rapit-reporting-base:1.0.0")
'de.rhocas.rapit:rapit-reporting-base:jar:1.0.0'
<dependency org="de.rhocas.rapit" name="rapit-reporting-base" rev="1.0.0">
  <artifact name="rapit-reporting-base" type="jar" />
</dependency>
@Grapes(
@Grab(group='de.rhocas.rapit', module='rapit-reporting-base', version='1.0.0')
)
libraryDependencies += "de.rhocas.rapit" % "rapit-reporting-base" % "1.0.0"
[de.rhocas.rapit/rapit-reporting-base "1.0.0"]

Dependencies

compile (4)

Group / Artifact Type Version
de.bmiag.tapir : tapir-execution jar 3.0.0
de.bmiag.tapir : tapir-bootstrap jar 3.0.0
org.springframework.boot : spring-boot-autoconfigure jar 1.5.9.RELEASE
org.springframework : spring-context jar

runtime (5)

Group / Artifact Type Version
org.apache.logging.log4j : log4j-core jar 2.7
org.apache.logging.log4j : log4j-slf4j-impl jar 2.7
org.apache.logging.log4j : log4j-jcl jar 2.7
org.apache.logging.log4j : log4j-1.2-api jar 2.7
org.apache.logging.log4j : log4j-jul jar 2.7

Project Modules

There are no modules declared in this project.

Build Status

ATTENTION! The rapit project is now part of the official tapir extensions at https://github.com/tapir-test/tapir-extensions. Thus this repository is no longer maintained.

rapit

The rapit project contains various unofficial extensions for the tapir Test framework.

How do I use it?

rapit Datasource Excel (since 1.0.0)

Note that this module uses the Apache Poi library, which means that the licenses of Apache Poi apply, when you use them.

The rapit Datasource Excel module is an adapter for tapir's datasource module. It allows you to fill your test data containers with data from Excel files. It works similar as the official CSV datasource module. To use it, you simply need to add it as Maven dependency.

<dependency>
	<groupId>de.rhocas.rapit</groupId>
	<artifactId>rapit-datasource-excel</artifactId>
	<version>1.0.0</version>
</dependency>

You can simply extend AbstractExcelDataSource if you need full control over the conversion from the excel row to your data type.

@Component
class UserExcelDataSource extends AbstractExcelDataSource<User> {

	override protected mapDataSet(ExcelRecord excelRecord) {
		...
	}

}

Now you can put the Excel file in your test classpath and inject the content into your test class with tapir's Resource annotation.

@Resource('user.xlsx')
User user

That's it. As the UserExcelDataSource is in the Spring context, it is automatically used by tapir to fill the user field with the content of the user.xlsx file. Note that currently only the first sheet of the Excel file is used. Furthermore, the first row of the excel sheet must contain the header names, which you can use to access the columns via the ExcelRecord class.

The rapit Datasource Excel module comes also with a useful dynamic annotation, which generates a default data source implementation for you. It works like the CSVDatasource annotation from tapir.

@ExcelDataSource
@Immutable
class User {
		
	String username
	Optional<String> password
		
}

Now rapit will generate the UserExcelDataSource for you and maps the columns of the Excel file to the fields. In order for this to work, the headers in the Excel sheet must be named like the fields (username and password in this case). If that is not possible, you can also use the ExcelColumn annotation to override the default mapping.

@ExcelDataSource
@Immutable
class User {
		
	@ExcelColumn('user')
	String username
	
	@ExcelColumn('pass')
	Optional<String> password
		
}

In this case the header names in the Excel sheet must be user and pass.

The conversion from the excel cells to the field types is performed with Spring's ConversionService. The cell's content is read as String and converted with the conversion service. This allows you to tap into the conversion by overriding the binding of this bean. However, the string representation of the Excel cell might not always be usable for the conversion service, especially when it comes to dates and such. In those cases it is recommended to either implement your own datasource or to force Excel to interpret the content of the cell as text by using a leading apostrophe.

rapit Reporting Base (since 1.0.0)

This module contains an implementation of tapir's execution listener, which can be used as a base for concrete reporting classes. To use it, you simply need to add it as Maven dependency.

<dependency>
	<groupId>de.rhocas.rapit</groupId>
	<artifactId>rapit-reporting-base</artifactId>
	<version>1.0.0</version>
</dependency>

tapir's default implementations use either frameworks which have to be informed about each event (JUnit) or have an internal model, which stores the events (Allure). However, some people might want to develop reporting listeners which simply convert the resulting execution at the end into a report instead of listening to each single execution event. The rapit reporting base provides the AbstractBaseReportingListener class which collects all the events during the execution. The concrete implementation of this class is informed after the execution and is provided with tapir's execution plan and a mapping to retrieve information about the execution.

rapit Excel Reporting (since 1.0.0)

Note that this module uses the Apache Poi library, which means that the licenses of Apache Poi apply, when you use it.

This module contains a reporting listener which writes an Excel report about the test execution. To use it, you simply need to add it as Maven dependency.

<dependency>
	<groupId>de.rhocas.rapit</groupId>
	<artifactId>rapit-reporting-excel</artifactId>
	<version>1.0.0</version>
</dependency>

As many other tapir modules, it contains an auto configuration, which means that it is already executed once it is part of the classpath. The execution listener has an order of 7000, which is equal to the Allure listener. Specify the output directory for the export with the property rapid.reporting.excel.outputDirectory. If you want to report to show step parameters, set the property rapid.reporting.excel.displayStepParameters to true. In this case it is recommended to use a custom labeled data container with singleLine set to true.

rapit Execution GUI (since 1.1.0)

Note that this module uses icons from the essential app icon set at https://www.iconfinder.com/iconsets/essential-app-1. This module uses also the mvvmFX framework, which means that the licenses of mvvmFX (and its dependencies) apply, when you use it.

This module contains a new launcher to start tapir test cases and test suites. It allows you to select which parts of the execution plan should be executed. To use it, you simply need to add it as Maven dependency.

<dependency>
	<groupId>de.rhocas.rapit</groupId>
	<artifactId>rapit-execution-gui</artifactId>
	<version>1.1.0</version>
</dependency>

Once the module is in your classpath, you can start the launcher by calling the main class "de.rhocas.rapit.execution.gui.RapitLauncher" with your test class or test suite as first parameter. In Eclipse you can add a launch configuration for this. Once the application is opened, it shows you the whole execution plan of the given test case. You can now select and deselect arbitrary steps in the execution plan. When you are finished, you can start the tests by clicking "Start Tests".

The GUI of the rapit launcher allows you not only to start your tests, but also to show the execution plan with different properties. In the lower part of the application, you can add properties and update the view by clicking on "Reinitialize Execution Plan". This is very useful if you are using tapir's variant or conditional module.

Unfortunately the usage of the launcher has a drawback: In Eclipse you can only start your tests with it, if the test cases are located in the main source folder (src/main/java by default). Otherwise the launcher cannot find the classes. Note also that the GUI uses JavaFX, which means that you might have to install JavaFX in addition, if you are using OpenJDK.

License

The rapit project is licensed under the MIT license. You can find a copy of it in the LICENSE file in the root folder of the project. Note that third party libraries, which are added as transitive dependencies, may have further and other licenses.

Versions

Version
1.0.0