Java, C#, Python, Go… — QATrax without Node.js
Produce your SBOM and your test report with your language's tools, then upload them like any customer.
Author: Dr Hamid MADANI <drmdh@msn.com>
QATrax does not read your code. It reads two standard files that every language can produce:
- the SBOM of your version: CycloneDX or SPDX, in JSON;
- the report of your tests, as your tool writes it: JUnit XML (the most widespread), NUnit, TRX, TestNG, Robot Framework, CTest, Cucumber JSON, Behave JSON, Allure 2, CTRF or TAP.
You change neither tool nor format: these are also the ones read by Xray, TestRail, Allure TestOps or Azure DevOps.
The rest of the path is the same for everyone: In short. Your requirements and your test plan are set once, as for any customer: Requirements and Dev+Test plan tabs.
1. Name your tests after your plan
Each test carries, at the start of its name, its reference in your plan (T-MOD-01). Languages refuse the hyphen in a function name; write it with _: it is recognised. In BDD (Cucumber, Behave), with Robot Framework or Allure, a tag equal to the reference is enough (@T-MOD-01).
| Language | Test name |
|---|---|
| Java (JUnit) | void test_T_MOD_01_aucune_vulnerabilite() |
| C# (xUnit, NUnit, MSTest) | public void test_T_MOD_01_aucune_vulnerabilite() |
| Python (pytest) | def test_T_MOD_01_aucune_vulnerabilite(): |
| Go | func Test_T_MOD_01_aucune_vulnerabilite(t *testing.T) |
| C++ (CTest) | add_test(NAME T_MOD_01_aucune_vulnerabilite COMMAND …) |
| Robot Framework | T-MOD-01 Aucune vulnérabilité (or the tag [Tags] T-MOD-01) |
| Cucumber, Behave | @T-MOD-01 above the scenario |
Format details: Test results format.
2. Produce the SBOM and the report
One tool for all languages: Syft reads your folder and produces the SBOM.
syft dir:. -o cyclonedx-json=sbom.cyclonedx.json
You can also use your language's CycloneDX tool:
| Language | SBOM (CycloneDX JSON) | Test report (as it is) | |
|---|---|---|---|
| Java — Maven | mvn org.cyclonedx:cyclonedx-maven-plugin:makeAggregateBom → target/bom.json | mvn test → target/surefire-reports/TEST-*.xml | |
| Java — Gradle | plugin org.cyclonedx.bom, then ./gradlew cyclonedxBom → build/reports/ | ./gradlew test → build/test-results/test/TEST-*.xml | |
| C# — .NET | the CycloneDX tool (dotnet tool install --global CycloneDX), or Syft | dotnet test --logger trx → TestResults/*.trx (TRX), or NUnit's TestResult.xml, or the JUnit from JunitXml.TestLogger | |
| Python | pip install cyclonedx-bom, then cyclonedx-py environment --output-format JSON --output-file sbom.cyclonedx.json | pytest --junitxml=resultats.xml | |
| Java — TestNG | as Maven or Gradle | testng-results.xml (native) | |
| Go | Syft | `go test -v ./... 2>&1 \ | go-junit-report > resultats.xml` |
| C, C++ — CMake | Syft | ctest -T Test → Testing/<date>/Test.xml (or ctest --output-junit resultats.xml) | |
| Robot Framework | Syft (or Python's CycloneDX tool) | robot … → output.xml | |
| BDD — Cucumber, Behave | the language's tool | --format json:cucumber.json; behave -f json -o behave.json | |
| Allure (any language) | the language's tool | allure-results/: jq -s . allure-results/*-result.json > allure.json for a single upload | |
| Other | Syft, or trivy fs --format cyclonedx --output sbom.cyclonedx.json . | any tool that writes one of these formats, JUnit XML or TAP |
3. Upload the two files
Through the interface. Journey tab: upload the SBOM at step ③, then the report at step ② (or in the Runs tab). The report is attached to the version chosen at the top of the page.
Through your CI. Create a key in the Projects tab, CI keys column, then send the two files with curl. Give the version (version=) in both requests: it is what files your tests under that version.
V=1.4.0 # the version you ship
curl -fsS -X POST "$QATRAX_URL/sbom?p=$QATRAX_PROJET&version=$V" \
-H "Authorization: Bearer $QATRAX_CLE" -H "content-type: application/json" \
--data-binary @sbom.cyclonedx.json
curl -fsS -X POST "$QATRAX_URL/runs?p=$QATRAX_PROJET&version=$V&format=json" \
-H "Authorization: Bearer $QATRAX_CLE" -H "content-type: application/xml" \
--data-binary @resultats.xml
The content-type matters little: the format is recognised from the content (.trx, output.xml, Test.xml, cucumber.json… are sent the same way). If you have several report files (one per test class with Maven and Gradle, one per test with Allure), send them one by one, or combine the Allure results into an array.
The response states the format read, the number of tests recognised in your plan and those that were not.
3a. Optional: the sealed report, as in Node.js
If your CI has Node.js (version 18 or later, present in most images), @mostajs/mjs-unit can read your tool's report. It does not re-run any test. It turns it into the sealed validation report, linked to your SBOM and your plan, and sends it with the plan and the SBOM. You have no JavaScript to write.
# Java (Maven): the Surefire reports; .NET: TestResults (the .trx files); Robot: output.xml; Allure: allure-results
export MJS_DEPUIS=target/surefire-reports MJS_SBOM=target/bom.json MJS_PLAN=plan.json
export QATRAX_URL=… QATRAX_CLE=… QATRAX_PROJET=…
npx -y -p @mostajs/mjs-unit mjs-unit-menu --choix=3 # reads the reports, writes the sealed validation report
npx -y -p @mostajs/mjs-unit mjs-unit-menu --choix=4 # sends the plan, the SBOM, then the validation report
With the validation report, qatrax makes two more checks: the report was not altered after it was read, and it is indeed the uploaded SBOM that was tested.
4. Issue
It is the same ending as for any customer: SBOM/Vulnerabilities tab, assess each one; then the Deliverable tab → Issue and seal.
What changes compared with Node.js
The verdict and the certificate are the same. Only one difference: the sealed validation report. If you send your JUnit or your TAP directly (curl), qatrax does not make the two checks of the validation report. It makes them if you go through mjs-unit in reader mode (§ 3a).