Skip to content

Commit bf6a501

Browse files
committed
vizzutest: log test cases number and actual pos
1 parent c1ddc13 commit bf6a501

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

test/integration/vizzutest.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ try {
3030

3131
#testCasesPath;
3232
#testCases = [];
33+
#testCasesRun = [];
3334
#testCasesData = {};
3435
#testCasesDataPath;
3536

@@ -162,14 +163,15 @@ try {
162163
async runTestSuite() {
163164
try {
164165
await this.#setUrl(argv.vizzuUrl);
165-
let testCases = this.#filterTestCases(argv._);
166-
if (testCases.length > 0) {
166+
this.#testCasesRun = this.#filterTestCases(argv._);
167+
if (this.#testCasesRun.length > 0) {
167168
this.#startTestSuite();
168-
for (let i = 0; i < testCases.length; i++) {
169-
await this.#runTestCase(testCases[i]);
169+
console.log('[ TESTS ]' + ' ' + '[ ' + this.#testCasesRun.length + ' / ' + this.#testCases.length + ' ]');
170+
for (let i = 0; i < this.#testCasesRun.length; i++) {
171+
await this.#runTestCase(i);
170172
}
171173
if (argv.reportLevel != 'DISABLED') {
172-
this.#createJson(__dirname + '/test_report/', testCases);
174+
this.#createJson(__dirname + '/test_report/', this.#testCasesRun);
173175
}
174176
}
175177
} catch (err) {
@@ -236,7 +238,8 @@ try {
236238
}
237239
}
238240

239-
async #runTestCase(testCase) {
241+
async #runTestCase(i) {
242+
let testCase = this.#testCasesRun[i];
240243
let testCaseResultPath = __dirname + '/test_report/' + testCase;
241244
let testCaseData = await this.#runTestCaseClient(testCase, this.#url);
242245
let testCaseResultObject = this.#getTestCaseResult(testCaseData, testCase);
@@ -245,20 +248,20 @@ try {
245248

246249
let createReport = false;
247250
if (testCaseResult == 'PASSED') {
248-
console.log(('[ ' + testCaseResult.padEnd(padLength, ' ') + ' ] ').success + testCase);
251+
console.log(('[ ' + testCaseResult.padEnd(padLength, ' ') + ' ] ').success + '[ ' + String(i + 1).padEnd(String(this.#testCasesRun.length).length, ' ') + ' ] ' + testCase);
249252
this.#testSuiteResults.PASSED.push(testCase);
250253
if (argv.reportLevel == 'INFO') {
251254
createReport = true;
252255
}
253256
} else if (testCaseResult == 'WARNING') {
254-
console.warn(('[ ' + testCaseResult.padEnd(padLength, ' ') + ' ] ' + '[ ' + testCaseResultObject.testCaseReultDescription + ' ] ').warn + testCase);
257+
console.warn(('[ ' + testCaseResult.padEnd(padLength, ' ') + ' ] ' + '[ ' + String(i + 1).padEnd(String(this.#testCasesRun.length).length, ' ') + ' ] [ ' + testCaseResultObject.testCaseReultDescription + ' ] ').warn + testCase);
255258
this.#testSuiteResults.WARNING.push(testCase);
256259
if (argv.reportLevel == 'INFO' || argv.reportLevel == 'WARN') {
257260
createReport = true;
258261
}
259262
} else {
260263
let errParts = testCaseResultObject.testCaseReultDescription.split('http://127.0.0.1:' + + String(this.#workspace.getWorkspacePort())).join(path.resolve(this.#workspacePath)).split('\n');
261-
console.error(('[ ' + testCaseResult.padEnd(padLength, ' ') + ' ] ' + '[ ' + errParts[0] + ' ] ').error + testCase);
264+
console.error(('[ ' + testCaseResult.padEnd(padLength, ' ') + ' ] ' + '[ ' + String(i + 1).padEnd(String(this.#testCasesRun.length).length, ' ') + ' ] [ ' + errParts[0] + ' ] ').error + testCase);
262265
if (errParts.length > 1) {
263266
errParts.slice(1).forEach(item => {
264267
console.error(''.padEnd(padLength + 7, ' ') + item);

0 commit comments

Comments
 (0)