From 75f394e8bcdf50d9b3f4c65a73b353573312766f Mon Sep 17 00:00:00 2001 From: Kuzma Rezchenko Date: Wed, 9 Dec 2020 14:30:42 +0200 Subject: [PATCH 1/2] Add html reports to api test --- shared.groovy | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/shared.groovy b/shared.groovy index d14d818..e0e4dce 100644 --- a/shared.groovy +++ b/shared.groovy @@ -255,10 +255,13 @@ def runNewman(ctx, postmanEnvironment) { ]) def okapiDns = "ec2-" + ctx.okapiIp.replaceAll(/\./, "-") + ".compute-1.amazonaws.com" dir("${env.WORKSPACE}/folio-api-tests") { - withDockerContainer(image: 'postman/newman', args: '--entrypoint=\'\'') { + withDockerContainer(image: 'postman/newman', args: '--user 0 --entrypoint=\'\'') { + sh "npm install -g newman-reporter-html" jsonFiles = findFiles(glob: '**/*.json') for (file in jsonFiles) { - if(file.path.split('/')[0] in excludeFolders) { + def folderName = file.path.split('/')[0] + def collectionName = file.name.tokenize('.')[0] + if(folderName in excludeFolders) { echo "[DEBUG] ${file} is skipped" continue } @@ -269,12 +272,14 @@ def runNewman(ctx, postmanEnvironment) { --suppress-exit-code 1 \ --env-var xokapitenant=${ctx.tenant} \ --env-var url=${okapiDns} \ - --reporter-junit-export junit_reports/${file.path.split('/')[0]}.xml \ - --reporters cli,junit + --reporter-junit-export test_reports/${collectionName}.xml \ + --reporter-html-export test_reports/${collectionName}.html \ + --reporters cli,junit,html """ //cucumber buildStatus: 'UNSTABLE', reportTitle: 'API tests report', fileIncludePattern: '**/junit_reports/*.xml', trendsLimit: 10 } - junit(testResults: 'junit_reports/*.xml') + junit(testResults: 'test_reports/*.xml') + archive('test_reports/**') } } } From 51bb4a658a726b8dc5f7fdd8f92f6787d5dfafb7 Mon Sep 17 00:00:00 2001 From: Kuzma Rezchenko Date: Fri, 11 Dec 2020 10:35:18 +0200 Subject: [PATCH 2/2] Exclude xml reports for postman tests --- shared.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared.groovy b/shared.groovy index e0e4dce..1894209 100644 --- a/shared.groovy +++ b/shared.groovy @@ -279,7 +279,7 @@ def runNewman(ctx, postmanEnvironment) { //cucumber buildStatus: 'UNSTABLE', reportTitle: 'API tests report', fileIncludePattern: '**/junit_reports/*.xml', trendsLimit: 10 } junit(testResults: 'test_reports/*.xml') - archive('test_reports/**') + archive('test_reports/*.htlm') } } }