Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify test results data #70

Merged
merged 7 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions src/data/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,30 @@
* @property {string} name name of the test plan, defaults to 'unknown'
* @property {AriaATCIData.Log[]} log debug messages emitted during execution of test plan
* @property {object[]} tests
* @property {string} tests[].id id of a test in a test plan
* @property {string} tests[].filepath filepath of file describing the test in the test plan
* @property {AriaATCIData.Log[]} tests[].log subset of log emitted during this single test
* @property {AriaATCIData.TestResult[]} tests[].results
* @property {AriaATCIData.TestResultOutput[]} tests[].results
*/

/**
* Result from a single test in a test plan.
* @typedef AriaATCIData.TestResult
* @property {number} testId numeric id of a test in a test plan
* @property {string} testId id of a test in a test plan
* @property {number} presentationNumber numeric id of a test in a test plan
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that in the previous version we were inserting the string id as testId even though the type specifies that we were expecting a numeric id. I updated the types to reflect this. I'm assuming we want to stick with using the string version as the id and not the numeric presentationNumber...

* @property {object[]} commands input commands and the speech emitted
* @property {string} commands[].command id of input command sent to system
* @property {string} [commands[].response] speech emitted
* @property {string[]} [commands[].errors] errors that occured while during command
* @property {object[]} commands[].assertions
* @property {string} commands[].assertions[].expectation
* @property {"pass"|"fail"|null} commands[].assertions[].verdict
* @property {Record<string, string>} capabilities Information about the system under test
*/

/**
* Result from a single test in a test plan.
* @typedef AriaATCIData.TestResultOutput
* @property {object[]} commands input commands and the speech emitted
* @property {string} commands[].command id of input command sent to system
* @property {string} [commands[].response] speech emitted
Expand Down
9 changes: 7 additions & 2 deletions src/host/plan-object.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export function addTestToTestPlan(testPlan, filepath) {
testPlan.files.find(file => file.name === filepath),
() => `File ${filepath} does not exist in test plan.`
);
return { ...testPlan, tests: [...testPlan.tests, { filepath, log: [], results: [] }] };
return { ...testPlan, tests: [...testPlan.tests, { filepath, id: '', log: [], results: [] }] };
}

/**
Expand Down Expand Up @@ -94,9 +94,14 @@ export function addTestLogToTestPlan(testPlan, { filepath: testFilepath }) {
*/
export function addTestResultToTestPlan(testPlan, testFilepath, result) {
const test = testPlan.tests.find(({ filepath }) => filepath === testFilepath);
const { testId, presentationNumber, ...resultOutput } = result;
return {
...testPlan,
tests: arrayUtil.replace(testPlan.tests, test, { ...test, results: [...test.results, result] }),
tests: arrayUtil.replace(testPlan.tests, test, {
...test,
id: testId,
results: [...test.results, resultOutput],
}),
};
}

Expand Down
1 change: 1 addition & 0 deletions src/host/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
* @property {object} serverOptions
* @property {AriaATCIShared.BaseURL} serverOptions.baseUrl
* @property {object[]} tests
* @property {string} tests[].id
* @property {string} tests[].filepath
* @property {number[]} tests[].log
* @property {Array} tests[].results
Expand Down
1 change: 0 additions & 1 deletion src/runner/mock-test-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ export class MockTestRunner {
}

return {
testId: task.info.testId,
capabilities: {
browserName: 'mock',
browserVersion: '1.0',
Expand Down
2 changes: 1 addition & 1 deletion src/runner/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

/**
* @typedef AriaATCIRunner.TestRunner
* @property {function(AriaATCIData.Test): Promise<AriaATCIData.TestResult>} run run a test
* @property {function(AriaATCIData.Test): Promise<AriaATCIData.TestResultOutput>} run run a test
*/

/**
Expand Down