Skip to content

Commit 7cdcfe7

Browse files
committed
Use Gherkin to define TCK for UUID and UUri serialization
The up-tck component had been using Gherkin for defining the TCK's test scenarios. The idea was that these could be used for verifying a language library's compliance with the specification. This is a first step in the direction described in eclipse-uprotocol/up-tck#116. The TCK's test scenarios have been adapted to cover more cases and, in particular, also cover failure cases. The corresponding unit tests have been replaced by Cucumber based tests and the Gherkin files have been amended with OpenFastTrace specification identifiers and are now also included when doing the requirements tracing run.
1 parent fb2d0d2 commit 7cdcfe7

15 files changed

+1557
-193
lines changed

.env.oft-current

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ UP_SPEC_FILE_PATTERNS="up-spec/*.adoc up-spec/*.md up-spec/basics up-spec/up-l1/
1717

1818
# The file patterns that specify this component's resources which contain specification items
1919
# that cover the requirements
20-
COMPONENT_FILE_PATTERNS="*.adoc *.md *.rs .github examples src tests tools"
20+
COMPONENT_FILE_PATTERNS="*.adoc *.md *.rs .github examples features src tests tools"
2121

2222
OFT_FILE_PATTERNS="$UP_SPEC_FILE_PATTERNS $COMPONENT_FILE_PATTERNS"
2323
OFT_TAGS=""

.env.oft-latest

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ UP_SPEC_FILE_PATTERNS="up-spec/*.adoc up-spec/*.md up-spec/basics up-spec/up-l1/
1717

1818
# The file patterns that specify this component's resources which contain specification items
1919
# that cover the requirements
20-
COMPONENT_FILE_PATTERNS="*.adoc *.md *.rs .github examples src tests tools"
20+
COMPONENT_FILE_PATTERNS="*.adoc *.md *.rs .github examples features src tests tools"
2121

2222
OFT_FILE_PATTERNS="$UP_SPEC_FILE_PATTERNS $COMPONENT_FILE_PATTERNS"
2323
OFT_TAGS="_,LanguageLibrary"

.github/workflows/check.yaml

+14-19
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ on:
2323
pull_request:
2424
paths:
2525
- "src/**"
26+
- "tests/**"
2627
- "Cargo.*"
2728
- "build.rs"
2829
- "deny.toml"
@@ -134,13 +135,11 @@ jobs:
134135
cargo hack check --feature-powerset --no-dev-deps
135136
136137
# [impl->req~up-language-ci-test~1]
137-
nextest:
138+
test:
138139
# Subset of feature-combos, on only one OS - more complete testing in test-featurematrix.yaml
139140
outputs:
140141
test_results_url: ${{ steps.test_results.outputs.artifact-url }}
141142
runs-on: ubuntu-latest
142-
env:
143-
NEXTEST_EXPERIMENTAL_LIBTEST_JSON: 1
144143
strategy:
145144
matrix:
146145
feature-flags: ["", "--no-default-features", "--all-features"]
@@ -151,28 +150,24 @@ jobs:
151150
- uses: dtolnay/rust-toolchain@master
152151
with:
153152
toolchain: ${{ env.RUST_TOOLCHAIN }}
154-
- uses: Swatinem/rust-cache@v2
155-
# install tool to convert cargo's JSON test output to JUNIT format
156-
- run: |
157-
cargo install cargo2junit
158-
# Using nextest because it's faster than built-in test
159-
- uses: taiki-e/install-action@nextest
160-
- name: Run cargo nextest
153+
154+
- name: Run lib tests
155+
run: |
156+
mkdir -p ${GITHUB_WORKSPACE}/target
157+
RUSTC_BOOTSTRAP=1 cargo test --no-fail-fast --lib ${{ matrix.feature-flags }} -- -Z unstable-options --format junit --report-time > ${GITHUB_WORKSPACE}/target/lib-test-results.xml
158+
- name: Run doc tests
161159
run: |
162-
cargo nextest run ${{ matrix.feature-flags }} --profile ci
163-
- name: Run doctests
160+
RUSTC_BOOTSTRAP=1 cargo test --no-fail-fast --doc ${{ matrix.feature-flags }} -- -Z unstable-options --format junit --report-time > ${GITHUB_WORKSPACE}/target/doc-test-results.xml
161+
- name: Run TCK tests
164162
run: |
165-
# we use tee to let cargo test print to the console
166-
RUSTC_BOOTSTRAP=1 cargo test --doc ${{ matrix.feature-flags }} -- -Z unstable-options --format json --report-time | tee target/doctest-results.json
167-
# write output to same directory as the one used by cargo nextest in order
168-
# to flatten the directory hierarchy when uploading the test results
169-
cat target/doctest-results.json | cargo2junit > target/nextest/ci/doctest-results.xml
163+
# the Cucumber based tests write a results file in JUnit format to "tck-[test_name]-results.xml"
164+
cargo test --no-fail-fast --test 'tck_*' ${{ matrix.feature-flags }} -- --junit-out-folder=${GITHUB_WORKSPACE}/target
170165
171166
- name: Upload all-features test results artifact
172167
id: test_results
173168
if: matrix.feature-flags == '--all-features'
174169
uses: actions/upload-artifact@v4
175170
with:
176171
name: test-results
177-
# this will include the nextest and doctest result files in the archive's root folder
178-
path: target/nextest/ci/*-results.xml
172+
# include all test result files
173+
path: target/*-results.xml

0 commit comments

Comments
 (0)