-
Notifications
You must be signed in to change notification settings - Fork 6
Getting Started
On this page you can find some simple examples, which should give you a quick start into CTM.
If you want to deepen your CTM knowledge, please see our CTM Guidebook on more configuration options.
-
In all given examples below we use GitHub issues to define our product requirements:
See our CTM Guidebook which other tools are supported by CTM
-
❗ All CTM command line calls are given here as
ctm <arguments>
.
In case you usedgo get github.com/SAP/quality-continuous-traceability-monitor
to obtain your CTM instance, please usequality-continuous-traceability-monitor <arguments>
to execute CTM.
Mac and Linux: You could also create a symbolic link asctm
toquality-continuous-traceability-monitor
to call CTM by it's abbreviation (ln -s $GOPATH/bin/quality-continuous-traceability-monitor $GOPATH/bin/ctm
).
- The product's source code is written in
Java
. Each automated test, that safeguards a product requirement, gets a specific comment which assigns the test to the corresponding product requirement.
...
/**
* Overwhelming complex test, which covers my
* product requirement #1
*/
// Trace(GitHub:doergn/sourcecodeRepo#1)
public void testApp() {
assertTrue(true);
}
...
Note the // Trace(GitHub:doergn/sourcecodeRepo#1)
comment which assign this test to product requirement #1
- CTM requires a configuration file to run. So we create a text file called
myCTMconfig.json
with the following content:
{
"github": {
"base_url": "https://github.com"
},
"workDir": "/tmp/CTM/workdir",
"outputDir": "/tmp/CTM/reports",
"log": {
"level": "INFO"
},
"sourcecode": [{
"local": "/home/doergn/sourcecodeRepo",
"language": "java"
}],
"testReport": [ {
"type": "xunit-xml",
"local": "/home/doergn/sourcecodeRepo/target/surefire-reports"
}]
}
Note the sourcecode
element which points to the local source code folder. The element testReport points to the local test result report.
Details on the other configuration elements can be found in the CTM Guidebook.
- Execute CTM with the just created config file:
ctm -c myCTMconfig.json
which should generate an output like:
I0817 10:20:56.924698 7759 performance.go:13] Parse java sourcecode (/home/doergn/sourcecodeRepo) took 1.029272ms
I0817 10:20:56.924872 7759 xunit.go:127] Parsing /home/doergn/sourcecodeRepo/target/surefire-reports/TEST-com.mycorp.AppTest.xml
I0817 10:20:56.925226 7759 performance.go:13] Scan xunit XML test reports took 372.21µs
I0817 10:20:56.925253 7759 performance.go:13] Create Traces took 1.251µs
I0817 10:20:56.925312 7759 performance.go:13] Create HTML and JSON reports took 51.785µs
- According to the output, CTM started parsing the java sourcecode in
/home/doergn/sourcecodeRepo
for traceability annotated tests which took it1.029272ms
- Second line shows it started parsing the xunit-xml test report
/home/doergn/sourcecodeRepo/target/surefire-reports/TEST-com.mycorp.AppTest.xml
as it was obviously the only xunit-xml test result it found in the configured path/home/doergn/sourcecodeRepo/target/surefire-reports
(seetestReport
configuration above) - With the collected data, CTM generated the overall traceability report (
json
andhtml
) and wrote it into the givenoutputDir
:- /tmp/CTM/reports/ctm_report_all.json
{ "doergn/sourcecodeRepo#1": { "link": "https://github.com/doergn/sourcecodeRepo/issues/1", "test_cases": [ { "test_fullname": "com.mycorp.AppTest.testApp", "test_name": "testApp", "test_class": "com.mycorp.AppTest", "passed": true, "skipped": false } ] } }
-
/tmp/CTM/reports/ctm_report_all.html
made with ❤ by SAP