Skip to content

Commit 855d23c

Browse files
committed
tests
1 parent 9712c09 commit 855d23c

File tree

1 file changed

+48
-25
lines changed

1 file changed

+48
-25
lines changed

src/test/testing/common/testingAdapter.test.ts

Lines changed: 48 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,11 @@ suite('End to End Tests: test adapters', () => {
121121
// verification after discovery is complete
122122

123123
// 1. Check the status is "success"
124-
assert.strictEqual(actualData.status, 'success', "Expected status to be 'success'");
124+
assert.strictEqual(
125+
actualData.status,
126+
'success',
127+
`Expected status to be 'success' instead status is ${actualData.status}`,
128+
);
125129
// 2. Confirm no errors
126130
assert.strictEqual(actualData.error, undefined, "Expected no errors in 'error' field");
127131
// 3. Confirm tests are found
@@ -161,7 +165,11 @@ suite('End to End Tests: test adapters', () => {
161165

162166
await discoveryAdapter.discoverTests(workspaceUri).finally(() => {
163167
// 1. Check the status is "success"
164-
assert.strictEqual(actualData.status, 'success', "Expected status to be 'success'");
168+
assert.strictEqual(
169+
actualData.status,
170+
'success',
171+
`Expected status to be 'success' instead status is ${actualData.status}`,
172+
);
165173
// 2. Confirm no errors
166174
assert.strictEqual(actualData.error, undefined, "Expected no errors in 'error' field");
167175
// 3. Confirm tests are found
@@ -200,8 +208,11 @@ suite('End to End Tests: test adapters', () => {
200208
// verification after discovery is complete
201209

202210
// 1. Check the status is "success"
203-
assert.strictEqual(actualData.status, 'success', "Expected status to be 'success'");
204-
// 2. Confirm no errors
211+
assert.strictEqual(
212+
actualData.status,
213+
'success',
214+
`Expected status to be 'success' instead status is ${actualData.status}`,
215+
); // 2. Confirm no errors
205216
assert.strictEqual(actualData.error?.length, 0, "Expected no errors in 'error' field");
206217
// 3. Confirm tests are found
207218
assert.ok(actualData.tests, 'Expected tests to be present');
@@ -239,8 +250,11 @@ suite('End to End Tests: test adapters', () => {
239250
await discoveryAdapter.discoverTests(workspaceUri, pythonExecFactory).finally(() => {
240251
// verification after discovery is complete
241252
// 1. Check the status is "success"
242-
assert.strictEqual(actualData.status, 'success', "Expected status to be 'success'");
243-
// 2. Confirm no errors
253+
assert.strictEqual(
254+
actualData.status,
255+
'success',
256+
`Expected status to be 'success' instead status is ${actualData.status}`,
257+
); // 2. Confirm no errors
244258
assert.strictEqual(actualData.error?.length, 0, "Expected no errors in 'error' field");
245259
// 3. Confirm tests are found
246260
assert.ok(actualData.tests, 'Expected tests to be present');
@@ -259,7 +273,11 @@ suite('End to End Tests: test adapters', () => {
259273
callCount = callCount + 1;
260274
// the payloads that get to the _resolveExecution are all data and should be successful.
261275
try {
262-
assert.strictEqual(payload.status, 'success', "Expected status to be 'success'");
276+
assert.strictEqual(
277+
payload.status,
278+
'success',
279+
`Expected status to be 'success', instead status is ${payload.status}`,
280+
);
263281
assert.ok(payload.result, 'Expected results to be present');
264282
} catch (err) {
265283
failureMsg = err ? (err as Error).toString() : '';
@@ -309,7 +327,7 @@ suite('End to End Tests: test adapters', () => {
309327
const validStatuses = ['subtest-success', 'subtest-failure'];
310328
assert.ok(
311329
validStatuses.includes(payload.status),
312-
`Expected status to be one of ${validStatuses.join(', ')}`,
330+
`Expected status to be one of ${validStatuses.join(', ')}, but instead status is ${payload.status}`,
313331
);
314332
assert.ok(payload.result, 'Expected results to be present');
315333
} catch (err) {
@@ -358,7 +376,11 @@ suite('End to End Tests: test adapters', () => {
358376
callCount = callCount + 1;
359377
// the payloads that get to the _resolveExecution are all data and should be successful.
360378
try {
361-
assert.strictEqual(payload.status, 'success', "Expected status to be 'success'");
379+
assert.strictEqual(
380+
payload.status,
381+
'success',
382+
`Expected status to be 'success', instead status is ${payload.status}`,
383+
);
362384
assert.ok(payload.result, 'Expected results to be present');
363385
} catch (err) {
364386
failureMsg = err ? (err as Error).toString() : '';
@@ -410,7 +432,11 @@ suite('End to End Tests: test adapters', () => {
410432
callCount = callCount + 1;
411433
// the payloads that get to the _resolveExecution are all data and should be successful.
412434
try {
413-
assert.strictEqual(payload.status, 'success', "Expected status to be 'success'");
435+
assert.strictEqual(
436+
payload.status,
437+
'success',
438+
`Expected status to be 'success', instead status is ${payload.status}`,
439+
);
414440
assert.ok(payload.result, 'Expected results to be present');
415441
} catch (err) {
416442
failureMsg = err ? (err as Error).toString() : '';
@@ -456,25 +482,17 @@ suite('End to End Tests: test adapters', () => {
456482
let callCount = 0;
457483
let failureOccurred = false;
458484
let failureMsg = '';
459-
resultResolver._resolveExecution = async (payload, _token?) => {
460-
traceLog(`resolveDiscovery ${payload}`);
461-
callCount = callCount + 1;
462-
// the payloads that get to the _resolveExecution are all data and should be successful.
463-
try {
464-
assert.strictEqual(payload.status, 'success', "Expected status to be 'success'");
465-
assert.ok(payload.result, 'Expected results to be present');
466-
} catch (err) {
467-
failureMsg = err ? (err as Error).toString() : '';
468-
failureOccurred = true;
469-
}
470-
return Promise.resolve();
471-
};
472485
resultResolver._resolveExecution = async (data, _token?) => {
473486
// do the following asserts for each time resolveExecution is called, should be called once per test.
474487
callCount = callCount + 1;
488+
console.log(`unittest execution adapter seg fault error handling \n ${data}`);
475489
try {
476490
// 1. Check the status is "success"
477-
assert.strictEqual(data.status, 'error', "Expected status to be 'error'");
491+
assert.strictEqual(
492+
data.status,
493+
'error',
494+
`Expected status to be 'error', instead status is ${data.status}`,
495+
);
478496
// 2. Confirm no errors
479497
assert.ok(data.error, "Expected errors in 'error' field");
480498
// 3. Confirm tests are found
@@ -523,10 +541,15 @@ suite('End to End Tests: test adapters', () => {
523541
let failureMsg = '';
524542
resultResolver._resolveExecution = async (data, _token?) => {
525543
// do the following asserts for each time resolveExecution is called, should be called once per test.
544+
console.log(`unittest execution adapter seg fault error handling \n ${data}`);
526545
callCount = callCount + 1;
527546
try {
528547
// 1. Check the status is "success"
529-
assert.strictEqual(data.status, 'error', "Expected status to be 'error'");
548+
assert.strictEqual(
549+
data.status,
550+
'error',
551+
`Expected status to be 'error', instead status is ${data.status}`,
552+
);
530553
// 2. Confirm no errors
531554
assert.ok(data.error, "Expected errors in 'error' field");
532555
// 3. Confirm tests are found

0 commit comments

Comments
 (0)