Skip to content

Commit bc58db0

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 bc58db0

16 files changed

+1513
-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

+13-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,23 @@ 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+
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
157+
- name: Run doc tests
161158
run: |
162-
cargo nextest run ${{ matrix.feature-flags }} --profile ci
163-
- name: Run doctests
159+
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
160+
- name: Run TCK tests
164161
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
162+
# the Cucumber based tests write a junit format results file to "target/tck-[test]-results.xml"
163+
cargo test --no-fail-fast --test 'tck_*' ${{ matrix.feature-flags }}
170164
171165
- name: Upload all-features test results artifact
172166
id: test_results
173167
if: matrix.feature-flags == '--all-features'
174168
uses: actions/upload-artifact@v4
175169
with:
176170
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
171+
# include all test result files
172+
path: target/*-results.xml

.github/workflows/nightly.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ jobs:
4949
uses: eclipse-uprotocol/ci-cd/.github/workflows/rust-x-build.yaml@main
5050

5151
coverage:
52+
# TODO: in order to allow tarpaulin to also gather coverage from the cucumber-rs based tests,
53+
# the 'cargo tarpaulin' command needs to contain option '--implicit-test-threads'
5254
uses: eclipse-uprotocol/ci-cd/.github/workflows/rust-coverage.yaml@main
5355

5456
current-spec-compliance:

.github/workflows/release.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ jobs:
3232
uses: eclipse-uprotocol/ci-cd/.github/workflows/rust-verify-msrv.yaml@main
3333

3434
coverage:
35+
# TODO: in order to allow tarpaulin to also gather coverage from the cucumber-rs based tests,
36+
# the 'cargo tarpaulin' command needs to contain option '--implicit-test-threads'
3537
uses: eclipse-uprotocol/ci-cd/.github/workflows/rust-coverage.yaml@main
3638

3739
current-spec-compliance:

0 commit comments

Comments
 (0)