Skip to content

Architecture and Design

guertlms edited this page Mar 6, 2020 · 4 revisions

Architecture and Design

This document contains the architecture and design of the system.

Hierarchical structure of examples

LivingDoc 2 uses a JUnit derived test annotation to declare tests. It’s main goal is the execution of table or textbased scenarios.

The graphic shows the class-hierarchy of Examples (named TestData in the code). There are two kinds of Examples. DecisionTables and Scenarios.

The class-hierarchy for the test-results is similarly structured.

architecture

Testflow

The following graphic visualized the work-flow during tests. First, business-experts define tests in form of tables (DecisionTable) or text (scenarios).

The next step is for test-engineers to write the logical part of the tests, which is called fixtures.

LivingDoc extends the JUnit-engine to execute the tests.

The outcome are results (for details of the types of results, check the graphic above). These results are used to create reports in html or json form. The report types are also extendable (See #29).

testprocess

Submodules

LivingDoc API

Package livingdoc-api

All annotations used for writing fixtures are defined in the api-package.

LivingDoc Config

Package livingdoc-config

The central ConfigProvider manages and loads the yaml configuration and provide simple type safe access to it for all other components.

LivingDoc Converters

Package livingdoc-converters

The converter package contains the available converters to convert the content of the examples (written in html- or md-files) to Kotlin-types.

JUnit Test Engine

Package livingdoc-junit-engine

The livingdoc-junit-engine subproject contains a JUnit test engine that can be used to run livingdoc tests by JUnit. The class org.livingdoc.junit.engine.LivingDocTestEngine is the main entrypoint for the JUnit test engine.

The JUnit TestEngine is currently the only test engine supported.

The subproject livingdoc-engine contains the implementation of the test logic independent of the testing tool.

LivingDoc Engine

Package livingdoc-engine

We use domain-driven design to define the internal data model of LivingDoc. The domain model is independent of:

  • TestEngine (e.g. JUnit)

  • JVM language

  • Testcase structure

graph LR
 
  Group --- DocumentFixture --- Fixture  
Loading

The Fixture maps Test Inputs to a series of interactions with the System under Test and evaluates Expectations. Fixture`s are an abstraction of the fixtures coded by a developer, a fixture is used to execute a Test Case. Each fixture type is respresented by an implementation of `Fixture. (e.g. Decisiontable - DecisionTableFixtureWrapper /Scenario - ScenarioFixtureWrapper)

A fixture can be executed using the execute method which takes the Testdata as an argument.

DocumentFixture represents a fixture for a complete document and uses Fixture`s to execute all `Testdata of the document. The DocumentFixture abstracts the code structure of the test cases e.g. the used fixture implementation can be external or nested classes.

A DocumentFixture can be executed using the execute method without arguments.

Groups group DocumentFixture`s. The `Group can be executed so using the execute method without arguments, which then executes all `DocumentFixture`s of the `Group`s.

The class LivingDoc is used as API entry point. It provides methods to execute Group and DocumentFixture. LivingDoc first creates the domain model and then calls the execute function on all `Group`s.

LivingDoc Repositories

Repositories

Package livingdoc-repositories

The repositories package contains the functionality stubs to decide the document type and parse html documents. It uses the ServiceLoader API and jsoup.

File-Repository

Package livingdoc-repository-file

Based on the repository the file repository contains the format (html vs. markdown) and the file fucntionality (load, configuration, structure, indentification). Basically the FileRepository is a something like [DocumentRepository] in a local filesystem.

Rest-Repository

Package livingdoc-repository-rest

Implements the ability to load a document from a server (REST), including the possibilty to configure via a yml file. In constrast to repository-file it a [DocumenRepository] in a non-local filesystem/server.

LivingDoc Results

Package livingdoc-results

Contains the results of the execution. The results are separated from the engine because extending the results would require the programmer to import the whole engine. This way only the result package can be imported.

Test project

The livingdoc-test subproject has been set up to to test the project using LivingDoc.