Skip to main content

tracematrix

A Python tool to create a traceability matrix.

Scope

This package focuses on generating the traceability matrix itself. As the APIs and export formats of different test management and/or requirement management tools can be very different, the data acquisition and conversion is not in the scope of this package. However, it aims to provide a convenient way to create the individual items (e.g. requirements, testcases or any other traceable item) and traces between them.

How to use this package

Currently it is only possible to use this package programmatically in your own script.

You start by creating an instance of TraceabilityMatrix. The output format is controlled by the reporter parameter. By default CsvReporter is used, but you can also generate HTML output by passing HtmlReporter.

from tracematrix.matrix import TraceabilityMatrix
from tracematrix.reporters import HtmlReporter

matrix = TraceabilityMatrix(reporter=HtmlReporter)

In the next step you add rows and columns to the matrix. Rows and columns can represent anything which may be traced against each other. Let's assume that we want to see traces between requirements and test cases. This is where your own logic comes into play - the way you determine which items exist and what is traced against each other is up to you and what the source of your data is. For this example, we just use some hardcoded values.

for testcase_id in ("TC_1", "TC_2", "TC_3"):
    matrix.add_row(testcase_id)
for requirement_id in ("REQ_1", "REQ_2", "REQ_3", "REQ_4"):
    matrix.add_column(requirement_id)

matrix.add_trace("TC_1", "REQ_1")
matrix.add_trace("TC_2", "REQ_2")
matrix.add_trace("TC_2", "REQ_3")

Note that rows and columns must be unique - you cannot have two rows or two columns with the same id. When you add a trace between a row and a column, the TraceabilityMatrix will look up the corresponding TraceItem instances itself.

Finally, you can save the output to disk:

matrix.write_matrix("traceability_matrix.html)

Changelog

V1.0.1

Fixes

  • Remove empty lines in CSV output on windows Closes #2

V1.0.0

API changes:

  • TraceItem has been degraded to a simple dataclass. The methods get_by_id and add_trace have been removed. Adding items (rows or columns) to a TraceabilityMatrix is now done by using TraceabilityMatrix.add_row(row_id) and TraceabilityMatrix.add_column(column_id). Traces between rows and columns are created by calling TraceabilityMatrix.add_trace(row_id, column_id). To all these methods, the id is passed as a string. The end user does not need to work with the TraceItem class any more.

Metadata

Release files for tracematrix 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tracematrix 1.0.1
File Size Uploaded
tracematrix-1.0.1.tar.gz 6.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tracematrix 1.0.1
File Interpreter ABI Platform
tracematrix-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 13.1 kB

Release files / tracematrix-1.0.1.tar.gz

Download URL tracematrix-1.0.1.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9304ae14dd04e4de7dd71c6cc0cf0371e9f2bdf8e52cb6e993211aac53f7a169
BLAKE2b-256 checksum
How to use checksums
00db1043953b6d2e080178ed4d3c068439c257a508f63bff1cf6b9ea9ddb5f68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.7 CPython/3.9.6 Linux/5.8.0-1040-azure

Release files / tracematrix-1.0.1-py3-none-any.whl

Download URL tracematrix-1.0.1-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bc6a6d643967f8c858f7d06e5afd8927c89a0f2af0dbc93fab9d68fbb1dfd81a
BLAKE2b-256 checksum
How to use checksums
fa861abc1d8c0376491a29d3871d034ad74a418667b8adf0ab98e62a1aba4e71
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.7 CPython/3.9.6 Linux/5.8.0-1040-azure

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

0.3.1

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page