- Suites contain multiple:
- READMEs
- Test Spec Files. Contains one:
- Test Group. Defines a test fixture and contains multiple:
- Tests. Defines a test function and contains multiple:
- Test Cases, each with the same test function but different parameters.
- Tests. Defines a test function and contains multiple:
- Test Group. Defines a test fixture and contains multiple:
A suite of tests.
A single suite has a directory structure, and many test spec files
(.spec.ts
files containing tests) and READMEs.
Each member of a suite is identified by its path within the suite.
Example: src/suites/*/
Example: src/suites/**/README.txt
Describes (in prose) the contents of a subdirectory in a suite.
Type: After a README is loaded, it is stored as a ReadmeFile
.
Uniquely identifies a single test spec file.
Comprised of suite name (suite
) and test spec file path relative to the suite root (path
).
Type: TestSpecID
Example: { suite: 'cts', path: 'command_buffer/compute/basic' }
corresponds to
src/suites/cts/command_buffer/compute/basic.spec.ts
.
Uniquely identifies a single test case within a test spec.
Comprised of test name (test
) and the parameters for a case (params
).
(If params
is null, there is only one case for the test.)
Type: TestCaseID
Example: { test: '', params: { 'value': 1 } }
A listing of the test spec files in a suite.
This can be generated only in Node, which has filesystem access (see src/tools/crawl.ts
).
As part of the build step, a listing file is generated (see src/tools/gen.ts
) so that the
test files can be discovered by the web runner (since it does not have filesystem access).
Type: TestSuiteListing
Example: out/suites/*/index.js
May be either a test spec file or a filtered test spec.
It is identified by a TestSpecID
.
Always contains one RunCaseIterable
.
Type: TestSpec
A single .spec.ts
file. It always contains one test group.
Example: src/suites/**/*.spec.ts
A subset of the tests in a single test spec file. It is created at runtime, via a filter.
It contains one "virtual" test group, which has type RunCaseIterable
.
A collection of test cases. There is one per test spec file.
Type: TestGroup
One test. It has a single test function.
It may represent multiple test cases, each of which runs the same test function with different parameters.
It is created by TestGroup.test()
.
At creation time, it can be parameterized via Test.params()
.
Type: Test
A test function is defined inline inside of a TestGroup.test()
call.
It receives an instance of the appropriate test fixture, through which it produce test results.
Type: TestFn
A single case of a test. It is identified by a TestCaseID
: a test name, and its parameters.
Type: During test run time, a case is encapsulated as a RunCase
.
Test fixtures provide helpers for tests to use. A new instance of the fixture is created for every run of every test case.
There is always one fixture class for a whole test group (though this may change).
The fixture is also how a test gets access to the case recorder, which allows it to produce test results.
They are also how tests produce results: .log()
, .fail()
, etc.
Type: Fixture
Provides basic fixture utilities most useful in the unittests
suite.
Provides utilities useful in WebGPU CTS tests.
- Queries contain multiple:
- Filters (positive or negative).
A query is a string which denotes a subset of a test suite to run. It is comprised of a list of filters. A case is included in the subset if it matches any of the filters.
In the WPT and standalone harnesses, the query is stored in the URL.
Queries are selectively URL-encoded for readability and compatibility with browsers.
Example: ?q=unittests:param_helpers:combine/=
Example: ?q=unittests:param_helpers:combine/mixed=
Type: None yet. TODO
A filter matches a set of cases in a suite.
Each filter may match one of:
S:s
In one suiteS
, all specs whose paths start withs
(which may be empty).S:s:t
In one specS:s
, all tests whose names start witht
(which may be empty).S:s:t~c
In one testS:s:t
, all cases whose params are a superset ofc
.S:s:t=c
In one testS:s:t
, the single case whose params equalc
(empty string ={}
).
Type: TestFilter
A set of cases can be split using negative filters. For example, imagine you have one WPT test variant:
webgpu/cts.html?q=unittests:param_helpers:
But one of the cases is failing. To be able to suppress the failing test without losing test coverage, the WPT test variant can be split into two variants:
webgpu/cts.html?q=unittests:param_helpers:¬=unittests:param_helpers:combine/mixed:
webgpu/cts.html?q=unittests:param_helpers:combine/mixed:
This runs the same set of cases, but in two separate page loads.
A logger logs the results of a whole test run.
It saves an empty LiveTestSpecResult
into its results array, then creates a
test spec recorder, which records the results for a group into the LiveTestSpecResult
.
Refers to a LiveTestSpecResult
in the logger, and writes results into it.
It saves an empty LiveTestCaseResult
into its LiveTestSpecResult
, then creates a
test case recorder, which records the results for a case into the LiveTestCaseResult
.
Records the actual results of running a test case (its pass-status, run time, and logs)
into its LiveTestCaseResult
.
The status
of a LiveTestCaseResult
can be one of:
'running'
'fail'
'warn'
'pass'
The "worst" result from running a case is always reported.
The results are returned in JSON format.
They are designed to be easily merged in JavaScript. (TODO: Write a merge tool.)
(TODO: Update these docs if the format changes.)
{
"version": "e24c459b46c4815f93f0aed5261e28008d1f2882-dirty",
"results": [
// LiveTestSpecResult objects
{
"spec": "unittests:basic:",
"cases": [
// LiveTestCaseResult objects
{
"test": "test/sync",
"params": null,
"status": "pass",
"timems": 145,
"logs": []
},
{
"test": "test/async",
"params": null,
"status": "pass",
"timems": 26,
"logs": []
}
]
},
{
"spec": "unittests:test_group:",
"cases": [
{
"test": "invalid test name",
"params": { "char": "\"" },
"status": "pass",
"timems": 66,
"logs": ["OK: threw"]
},
{
"test": "invalid test name",
"params": { "char": "`" },
"status": "pass",
"timems": 15,
"logs": ["OK: threw"]
}
]
}
]
}