SW-Tests

SW-Tests

Test case naming

This file contains the software test cases of trlcdoc. There is one test case per pytest test function in the tests folder: the test function test_<name> implements the test case tc_<name>. The test result report relates the pytest results to the test cases by this naming rule.

Most test cases run trlcdoc on a minimal example project, created by the test fixtures in a temporary folder.

Command Line Interface

tc_cli

Attribute Name

Attribute Value

Description

Run trlcdoc as console script and as Python module python -m trlcdoc with the check step. Check the exit code 0 and the console output (tests/test_cli.py).

Verifies

tc_cli_help

Attribute Name

Attribute Value

Description

Call trlcdoc with -h and with --help. Check that the usage help with all steps, the copyright and the repository link is shown and the exit code is 0 (tests/test_cli.py).

Verifies

tc_cli_version

Attribute Name

Attribute Value

Description

Call trlcdoc with --version. Check that the version of the installed package is shown and the exit code is 0, and that -v is the short option of --verbose (tests/test_cli.py).

Verifies

tc_verbose_output

Attribute Name

Attribute Value

Description

Verbose output (tests/test_log.py)

Run the tests step without -v, with -v and with -vv. Check

  • that the default output has no verbose lines

  • the decisions and tool details with -v

  • the environment and the test details with -vv

  • that the test results are the same

Verifies

tc_verbose_secrets

Attribute Name

Attribute Value

Description

No secrets in the verbose output (tests/test_log.py)

Run with -vv, a secret environment variable and a PlantUML server URL with user and password. Check that neither the secret nor the password is shown.

Verifies

tc_verbose_tools

Attribute Name

Attribute Value

Description

Verbose tool output (tests/test_log.py)

Run commands with -v, one with input and one ended by a signal (not on Windows). Check the input size, exit code and signal name, the shell quoting of a command and the Sphinx verbosity for each level.

Verifies

tc_interrupted

Attribute Name

Attribute Value

Description

Interrupt (tests/test_log.py)

Interrupt a step with Ctrl+C. Check the exit code 130 and the message.

Verifies

tc_steps

Attribute Name

Attribute Value

Description

Step selection (tests/test_cli.py)

Call trlcdoc

  • without step

  • with a single step

  • with clean all

  • with a configuration without tests and trace settings

  • with an unknown step

Check the executed steps and the error exit code for the unknown step.

Verifies

tc_step_order

Attribute Name

Attribute Value

Description

Request steps in reverse order and request the convert step alone. Check that the steps run in the fixed order and that the plantuml step is added (tests/test_cli.py).

Verifies

tc_exit_code

Attribute Name

Attribute Value

Description

Exit codes (tests/test_cli.py)

Run

  • the tests step on a project with passing tests

  • the tests step on a project with failing tests

  • the check step with a missing configuration

  • the tests step with a missing program in tests.command

  • the html step with a missing program in a command document

Check the exit codes 0, 1 and 2, and that a missing program is named in the error without traceback.

Verifies

tc_external_tools

Attribute Name

Attribute Value

Description

External tools (tests/test_cli.py)

Run without Java and Graphviz on the PATH

  • the plantuml step with a PlantUML jar and with a PlantUML server

  • the trace step

  • the html step with the reStructuredText tracing report

Check the exit codes and the missing tool named in the error message.

Verifies

Configuration

tc_config_file

Attribute Name

Attribute Value

Description

Configuration file discovery (tests/test_config.py)

  • Find trlcdoc.yaml from the project root and from a subfolder.

  • Run the check step from a subfolder, with an explicit configuration file and with a missing one.

Check the used configuration and the error.

Verifies

tc_config_validation

Attribute Name

Attribute Value

Description

Configuration validation (tests/test_config.py)

Load configurations violating the schema, including a pyTRLCConverter option outside the pyTRLCConverter options of a document, and configurations with

  • an unknown include

  • a duplicate document id

  • a missing converter file

  • missing HTML site files and a missing project logo and favicon

  • an undefined trace level

  • a missing Doxyfile

Check that every error is reported with its location, and that no step runs. Load a configuration file with known line numbers and reference errors, schema errors, a missing key, a key that is not allowed and a repeated document id. Check that each error starts with the file and line of its entry, the missing key with the line of its parent, the repeated id with the line of its second occurrence. Load a file that is no valid YAML and check that the syntax error is reported with its position and exit code 2.

Load test link configurations with property, output pattern, name pattern, output and name pattern, no link method, an output pattern without {id}, from without to and to alone. Check that only the first four are valid.

Load implementation levels with lobster-python and lobster-doxygen, each with sources, doxyfile or both. Check that only lobster-python with sources and lobster-doxygen with doxyfile are valid.

Verifies

tc_toctree_check

Attribute Name

Attribute Value

Description

Table of contents check (tests/test_pages.py)

Run the check step with project start pages listing

  • TRLC documents and the reStructuredText tracing report without /index

  • an unknown page and a page of a Sphinx extension

  • not every document

Check the findings with the right page names and their reason, and the exit code 1. Check that the same start page is right for the tracing report in HTML format, that a start page with placeholders, page names and a Markdown document with its own toctree has no findings, and that misspelled {page:<id>} placeholders are configuration errors.

Verifies

tc_toctree_entries

Attribute Name

Attribute Value

Description

Read the toctree entries of a reStructuredText page with LF and CRLF line ends and of a Markdown page with MyST toctrees. Check that titles, a leading /, source suffixes, options, self, URLs and glob patterns are handled (tests/test_pages.py).

Verifies

tc_project_settings

Attribute Name

Attribute Value

Description

Configure the project name, version, author, copyright, logo and repository. Check the settings passed to the HTML site, the default repository auto and that the version is optional (tests/test_config.py).

Verifies

tc_output_folder

Attribute Name

Attribute Value

Description

Output folder location (tests/test_config.py)

Check

  • the default output folder

  • that all generated paths are inside it

  • a configured output folder

  • the errors for the project root, its parent and the trlcdoc package folder as output folder

Verifies

tc_output_option

Attribute Name

Attribute Value

Description

Output folder option (tests/test_cli.py)

Run steps with -o and --output. Check

  • that a relative folder is relative to the current folder and an absolute one is used as given

  • that the tests step writes into the given folder and the configured one is not created

  • that the clean step removes the given folder and keeps the configured one

  • the errors for the project root, its parent and the trlcdoc package folder as option

  • that a forbidden configured output folder is ignored with the option

Verifies

Output Folder

tc_output_marker

Attribute Name

Attribute Value

Description

Use a missing and prepare an empty output folder. Check that both are marked as trlcdoc output folder (tests/test_output.py).

Verifies

tc_clean

Attribute Name

Attribute Value

Description

Clean step (tests/test_output.py)

Run the clean step after creating build artifacts and once more without output folder. Check

  • that the output folder is removed

  • that the project files are kept

  • the messages

Verifies

tc_delete_protection

Attribute Name

Attribute Value

Description

Delete protection (tests/test_output.py)

  • Configure the project tests folder as output folder and run the clean, tests and convert steps.

  • Clean folders outside of the output folder.

Check the errors, the exit code 2 and that the folder content is unchanged.

Verifies

Documents

tc_plantuml

Attribute Name

Attribute Value

Description

PlantUML provision (tests/test_plantuml.py)

Provide PlantUML by

  • a (simulated) download of the configured and the default version

  • a reused download

  • a configured jar

  • a jar and a server URL in the PLANTUML environment variable

  • a missing jar

Check the selected jar or server, the exported environment variable and the error.

Verifies

tc_plantuml_headless

Attribute Name

Attribute Value

Description

Headless PlantUML (tests/test_plantuml.py)

Check that the PlantUML jar runs headless:

  • the Sphinx configuration of the html step passes -Djava.awt.headless=true to Java

  • the convert step adds it to JAVA_TOOL_OPTIONS on (simulated) macOS, keeping the options of the user

  • the convert step adds it only once

  • the convert step adds nothing on (simulated) Linux and Windows

Verifies

tc_plantuml_picoweb

Attribute Name

Attribute Value

Description

Local PlantUML server (tests/test_plantuml.py)

Provide PlantUML with a jar and check that

  • a picoweb server runs on a port of 127.0.0.1, its URL is exported, NO_PROXY gets 127.0.0.1 once

  • the Sphinx configuration runs the PlantUML client with the URL, which renders an SVG diagram

  • the client renders PNG by default, and returns the error image and exit code 1 on a syntax error

  • SIGTERM ends the run with exit code 143

  • stopping ends the process and restores PLANTUML, NO_PROXY and the SIGTERM handler

  • no server is started with plantuml.picoweb: false or a server URL in PLANTUML

Verifies

tc_plantuml_picoweb_stop

Attribute Name

Attribute Value

Description

Stopping the local PlantUML server (tests/test_plantuml.py)

Run trlcdoc with a PlantUML jar and check that the picoweb server process has ended

  • after a successful run

  • after a build error in the step after the plantuml step

  • after an interrupt (Ctrl+C) in the step after the plantuml step

Verifies

tc_plantuml_picoweb_fallback

Attribute Name

Attribute Value

Description

Fallback to the PlantUML jar (tests/test_plantuml.py)

Provide PlantUML with

  • a jar that Java cannot run

  • a server that doesn’t answer in time

  • a Java that cannot be started

Check the warning, the exported jar and that no server process is left.

Verifies

tc_trlc_conversion

Attribute Name

Attribute Value

Description

TRLC conversion (tests/test_convert.py)

Convert the architecture of the example project, which includes the requirements, with a project converter, translation and render configuration into reStructuredText and Markdown. Check that the architecture records are converted and the included requirements are not.

Verifies

tc_builtin_converters

Attribute Name

Attribute Value

Description

Built-in converters (tests/test_convert.py)

Convert the requirements, architecture, test cases and test results of the example project with the built-in converters into both formats. Check the converted content, the anchors of the test results in reStructuredText and the error for missing test results.

Verifies

tc_conversion_error

Attribute Name

Attribute Value

Description

Conversion errors (tests/test_convert.py)

Convert an architecture with an unresolved requirement reference, and a document without Markdown converter. Check the build error and that only the configured format is converted.

Verifies

Tests

tc_test_run

Attribute Name

Attribute Value

Description

Test run (tests/test_testrun.py)

Run the tests of the example project

  • with pytest and coverage

  • with a failing test

  • with a test command

  • with a command not writing the result file, after a run that wrote it

  • with a command writing its coverage report

  • with a command not writing its coverage report, after a run that wrote it

Check the result file, the coverage report, the test result and the errors.

Verifies

tc_test_results

Attribute Name

Attribute Value

Description

Test result records (tests/test_testrun.py)

Read a JUnit XML file with

  • passed, failed, erroneous, parametrized and skipped tests

  • property linked and unlinked tests

  • a test linked to two test cases

Check

  • the linked test cases

  • the errors for the unlinked test and for two test cases without relates array

  • that the written test result records with single and array relates are valid TRLC

Verifies

tc_test_results_output

Attribute Name

Attribute Value

Description

Test results linked by output (tests/test_testrun.py)

Read a Ceedling JUnit XML file with Unity suite output: a test tracing a test case twice and to a second test case, a failed test, a skipped test, a second suite, an unrelated message and a trace line without Unity prefix. Read a pytest JUnit XML file with test case output, with a test having a property and output, and with tests without output.

Check

  • the linked test cases per test, without duplicates and without the line lacking the Unity prefix

  • the error for several test cases without relates array

  • that the property is used before the output, and the output before the name pattern

  • the error naming the link methods for tests without output and without name pattern

  • that the written test result records are valid TRLC

Verifies

tc_test_results_package

Attribute Name

Attribute Value

Description

Package of the test result records (tests/test_testrun.py)

Write test result records linked to test cases

  • of another package than the name pattern

  • of several packages

  • without package

  • and without any linked test

Check the package of the written records and the errors.

Verifies

Tracing

tc_trace_levels

Attribute Name

Attribute Value

Description

Create the tracing report of the example project. Check the generated LOBSTER policy and extraction configuration, and the traced items with their links (tests/test_trace.py).

Verifies

tc_trace_report

Attribute Name

Attribute Value

Description

Online tracing report (tests/test_trace.py)

Create the tracing report

  • offline

  • online with a configured repository

  • online with the repository derived from the git origin remote

  • online for a project in a subfolder of the repository

  • online with an output folder outside the repository

Check the links to the repository files at the current commit, with the subfolder for a project in a subfolder. Check that the test results link to their row on the site page, named by their record, not to their generated records.

Verifies

tc_trace_markdown

Attribute Name

Attribute Value

Description

Markdown descriptions in the tracing report (tests/test_trace.py)

Create the tracing report of a requirement with a wrapped Markdown description

  • with the default settings

  • with markdown: true

Check that the description is plain text with line breaks by default, and rendered Markdown in one paragraph with markdown.

Verifies

tc_trace_report_rst

Attribute Name

Attribute Value

Description

Tracing report as site pages (tests/test_html.py)

Build a site with a page header and report: rst. Check

  • the start page with the configured title and the coverage summary instead of the LOBSTER title

  • a page per trace level with the item cards and the page header

  • that the item source links are relative and point to the project files

  • that the test results link to their row on the site page, named by their record

  • that no HTML tracing report is created

Verifies

tc_page_placeholders

Attribute Name

Attribute Value

Description

Replace {page:<id>}, {documents} and {project_root} for a page at the top and in a document folder, with both tracing report formats. Check the relative page names, the kept indentation and CRLF line end of {documents} and that an unknown id is left unchanged (tests/test_pages.py).

Verifies

tc_documents_placeholder_unlisted

Attribute Name

Attribute Value

Description

{documents} without explicitly listed documents (tests/test_pages.py)

Replace {documents} in a start page that also lists two documents in a section of its own, by {page:<id>} and by page name, with a Markdown document that lists a third one. Check that {documents} lists only the remaining documents, also relative to a page in a document folder, and that the check step has no findings.

Verifies

tc_page_placeholders_site

Attribute Name

Attribute Value

Description

Page placeholders in a site (tests/test_html.py)

Build a site whose start page contains only {documents}, whose page header and a project page link with {page:<id>}, once with each tracing report format. Check the table of contents in configuration order with the page name of each format, the links from pages at different depths and that the check step has no findings.

Verifies

tc_trace_findings

Attribute Name

Attribute Value

Description

Create the tracing report of a project with an untraced requirement. Check the listed item, its tracing status and the exit code 1 (tests/test_trace.py).

Verifies

tc_trace_justified

Attribute Name

Attribute Value

Description

Create the tracing report of a project with an implementation level that has a function marked with lobster-exclude. Check that the function is counted as justified and not listed as untraced, and the exit code 0 (tests/test_trace.py).

Verifies

tc_trace_doxygen

Attribute Name

Attribute Value

Description

C/C++ code tracing (tests/test_trace.py)

Create the tracing report of a project with a C function, an @implements tag and a Doxyfile in a tools folder. Check that the function traces to its requirement and that no doxygen output lands next to the Doxyfile. Repeat with the Doxyfile in the source folder, and check that the source file of the item is absolute in both cases. Without doxygen on the PATH, check the error naming the trace level, and that a project without lobster-doxygen level still creates its report. The test is skipped if doxygen is not installed.

Verifies

HTML Site

Shared HTML site

The HTML site test cases share one site, built with trlcdoc all from the example project in a git repository. It contains a PlantUML diagram and a document of every type. They need a Java runtime for PlantUML.

tc_html_site

Attribute Name

Attribute Value

Description

Check the exit code 0 of the build, the start page with the table of contents, and that every listed page exists (tests/test_html.py).

Verifies

tc_documents

Attribute Name

Attribute Value

Description

Check that the pages appear in the configured order with their configured titles (tests/test_html.py). A Markdown page with configured title shows it in the table of contents, the navigation links and the browser title, and keeps its own heading in the page. A page without configured title is listed with its first heading.

Verifies

tc_document_types

Attribute Name

Attribute Value

Description

Document types (tests/test_html.py)

Check the content of the document pages of type

  • TRLC

  • test result

  • tracing report

  • HTML

  • reStructuredText

  • Markdown

  • text

  • command

Check the rendered diagram.

Verifies

tc_html_customization

Attribute Name

Attribute Value

Description

HTML site customization (tests/test_html.py)

Build a separate site with

  • a project start page, page header and Sphinx configuration file

  • a project page including a project file

  • a project page with disabled placeholder replacement

  • a TRLC document without title

Check

  • the table of contents

  • the page header on the generated pages

  • the page titles

  • that the placeholder is kept on the page with disabled replacement

  • the applied configuration and its setup

  • that the Sphinx cache is not part of the site

Verifies

tc_html_version_info

Attribute Name

Attribute Value

Description

Check that every page shows the git describe output and the branch the site was built from (tests/test_html.py).

Verifies

tc_html_version_info_git_state

Attribute Name

Attribute Value

Description

Version control state (tests/test_html.py)

Check the version control state of the page footer

  • outside of a git repository: empty

  • on a tag: the tag and the branch

  • with uncommitted changes of a tracked file: the -dirty suffix

  • after a commit: the distance to the tag and the short commit hash

  • with a detached HEAD: no branch

Verifies

tc_show

Attribute Name

Attribute Value

Description

Show step (tests/test_html.py)

Run the show step

  • with a built site, under Linux/Windows and under WSL

  • without a built site

  • without an available web browser

Check the opened page, that all does not include the show step, the error messages and the exit code 2 on errors.

Verifies