From 5770d8f8476ec11e83d950b217865904510bc7b3 Mon Sep 17 00:00:00 2001 From: Giuseppe Penone Date: Thu, 5 Oct 2017 16:16:49 +0100 Subject: [PATCH 1/3] exposing new env var TESTLINK_TESTCASE_PLATFORM --- .../java/hudson/plugins/testlink/TestLinkBuilder.java | 10 +++++----- .../plugins/testlink/result/TestCaseWrapper.java | 3 +++ .../hudson/plugins/testlink/util/TestLinkHelper.java | 2 ++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main/java/hudson/plugins/testlink/TestLinkBuilder.java b/src/main/java/hudson/plugins/testlink/TestLinkBuilder.java index bc3a428..13c9a04 100644 --- a/src/main/java/hudson/plugins/testlink/TestLinkBuilder.java +++ b/src/main/java/hudson/plugins/testlink/TestLinkBuilder.java @@ -236,10 +236,10 @@ public boolean perform(AbstractBuild build, Launcher launcher, } for(TestCaseWrapper tcw : automatedTestCases) { - testLinkSite.getReport().addTestCase(tcw); - if(LOGGER.isLoggable(Level.FINE)) { - LOGGER.log(Level.FINE, "TestLink automated test case ID [" + tcw.getId() + "], name [" +tcw.getName()+ "]"); - } + testLinkSite.getReport().addTestCase(tcw); + if(LOGGER.isLoggable(Level.FINE)) { + LOGGER.log(Level.FINE, "TestLink automated test case ID [" + tcw.getId() + "], name [" + tcw.getName() + "], platform [" + tcw.getPlatform() + "]"); + } } listener.getLogger().println(Messages.TestLinkBuilder_ExecutingSingleBuildSteps()); @@ -471,4 +471,4 @@ public String getDisplayName() { public Descriptor getDescriptor() { return (TestLinkBuilderDescriptor) super.getDescriptor(); } -} \ No newline at end of file +} diff --git a/src/main/java/hudson/plugins/testlink/result/TestCaseWrapper.java b/src/main/java/hudson/plugins/testlink/result/TestCaseWrapper.java index bc0d45e..dfadfa4 100644 --- a/src/main/java/hudson/plugins/testlink/result/TestCaseWrapper.java +++ b/src/main/java/hudson/plugins/testlink/result/TestCaseWrapper.java @@ -87,6 +87,9 @@ public TestCaseWrapper(TestCase testCase) { this.notes = new StringBuilder(); this.attachments = new LinkedList(); this.customFieldAndStatus = new HashMap(); + if (this.testCase.getPlatform() != null) { + this.setPlatform(this.testCase.getPlatform().getName()); + } } /** diff --git a/src/main/java/hudson/plugins/testlink/util/TestLinkHelper.java b/src/main/java/hudson/plugins/testlink/util/TestLinkHelper.java index 6258a2a..f2405be 100644 --- a/src/main/java/hudson/plugins/testlink/util/TestLinkHelper.java +++ b/src/main/java/hudson/plugins/testlink/util/TestLinkHelper.java @@ -62,6 +62,7 @@ public final class TestLinkHelper { private static final String TESTLINK_TESTCASE_TESTPROJECT_ID = "TESTLINK_TESTCASE_TESTPROJECTID"; private static final String TESTLINK_TESTCASE_AUTHOR_ENVVAR = "TESTLINK_TESTCASE_AUTHOR"; private static final String TESTLINK_TESTCASE_SUMMARY_ENVVAR = "TESTLINK_TESTCASE_SUMMARY"; + private static final String TESTLINK_TESTCASE_PLATFORM_ENVVAR = "TESTLINK_TESTCASE_PLATFORM"; private static final String TESTLINK_BUILD_NAME_ENVVAR = "TESTLINK_BUILD_NAME"; private static final String TESTLINK_TESTPLAN_NAME_ENVVAR = "TESTLINK_TESTPLAN_NAME"; private static final String TESTLINK_TESTPROJECT_NAME_ENVVAR = "TESTLINK_TESTPROJECT_NAME"; @@ -187,6 +188,7 @@ public static Map createTestLinkEnvironmentVariables(TestCaseWra testLinkEnvVar.put( TESTLINK_TESTCASE_TESTPROJECT_ID, ""+testCase.getTestProjectId() ); testLinkEnvVar.put( TESTLINK_TESTCASE_AUTHOR_ENVVAR, ""+testCase.getAuthorLogin() ); testLinkEnvVar.put( TESTLINK_TESTCASE_SUMMARY_ENVVAR, StringUtils.defaultIfEmpty(testCase.getSummary(), "") ); + testLinkEnvVar.put( TESTLINK_TESTCASE_PLATFORM_ENVVAR, StringUtils.defaultIfEmpty(testCase.getPlatform(), "") ); testLinkEnvVar.put( TESTLINK_BUILD_NAME_ENVVAR, StringUtils.defaultIfEmpty(build.getName(), "")); testLinkEnvVar.put( TESTLINK_TESTPLAN_NAME_ENVVAR, StringUtils.defaultIfEmpty(testPlan.getName(), "")); testLinkEnvVar.put( TESTLINK_TESTPROJECT_NAME_ENVVAR, StringUtils.defaultIfEmpty(testProject.getName(), "")); From e3d87e3fc9e521076777ce63695ad6cbbba5dfab Mon Sep 17 00:00:00 2001 From: Giuseppe Penone Date: Fri, 6 Oct 2017 12:31:13 +0100 Subject: [PATCH 2/3] testCase Platform - support for .tap filename ending '-'.tap for same test run on more platforms --- .../testlink/result/AbstractTAPFileNameResultSeeker.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/hudson/plugins/testlink/result/AbstractTAPFileNameResultSeeker.java b/src/main/java/hudson/plugins/testlink/result/AbstractTAPFileNameResultSeeker.java index 07d903d..17bbc6e 100644 --- a/src/main/java/hudson/plugins/testlink/result/AbstractTAPFileNameResultSeeker.java +++ b/src/main/java/hudson/plugins/testlink/result/AbstractTAPFileNameResultSeeker.java @@ -140,6 +140,7 @@ public void checkRoles(RoleChecker roleChecker) throws SecurityException { for (TestCaseWrapper automatedTestCase : automatedTestCases) { final String[] commaSeparatedValues = automatedTestCase .getKeyCustomFieldValues(this.keyCustomField); + final String testCasePlatform = automatedTestCase.getPlatform(); for (String value : commaSeparatedValues) { String tapFileNameWithoutExtension = key; int leftIndex = 0; @@ -153,7 +154,8 @@ public void checkRoles(RoleChecker roleChecker) throws SecurityException { tapFileNameWithoutExtension = tapFileNameWithoutExtension.substring(leftIndex, tapFileNameWithoutExtension.lastIndexOf('.')); } - if (tapFileNameWithoutExtension.equals(value)) { + if ( (testCasePlatform != null && tapFileNameWithoutExtension.equals(value+"-"+testCasePlatform)) || + (tapFileNameWithoutExtension.equals(value)) ) { this.updateTestCase(testSets, key, automatedTestCase, value, build, listener, testlink); } } From 5fd5fd12efd7b7aa2235cfccca02d5077044c1b0 Mon Sep 17 00:00:00 2001 From: Giuseppe Penone Date: Tue, 10 Oct 2017 14:58:47 +0100 Subject: [PATCH 3/3] added 'Platform' column to summary table of Jenkins job build --- src/main/java/hudson/plugins/testlink/util/TestLinkHelper.java | 3 +++ .../resources/hudson/plugins/testlink/util/Messages.properties | 1 + .../hudson/plugins/testlink/util/Messages_en.properties | 1 + .../hudson/plugins/testlink/util/Messages_es.properties | 1 + .../hudson/plugins/testlink/util/Messages_fr.properties | 3 ++- .../hudson/plugins/testlink/util/Messages_pt.properties | 1 + 6 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/hudson/plugins/testlink/util/TestLinkHelper.java b/src/main/java/hudson/plugins/testlink/util/TestLinkHelper.java index f2405be..3203f46 100644 --- a/src/main/java/hudson/plugins/testlink/util/TestLinkHelper.java +++ b/src/main/java/hudson/plugins/testlink/util/TestLinkHelper.java @@ -389,6 +389,8 @@ public static String createReportSummaryDetails(Report report, Report previous) builder.append(""); builder.append(Messages.ReportSummary_Details_Name()); builder.append(""); + builder.append(Messages.ReportSummary_Details_Platform()); + builder.append(""); builder.append(Messages.ReportSummary_Details_TestProjectId()); builder.append(""); builder.append(Messages.ReportSummary_Details_ExecutionStatus()); @@ -402,6 +404,7 @@ public static String createReportSummaryDetails(Report report, Report previous) builder.append(""+tc.getFullExternalId()+""); builder.append(""+tc.getVersion()+""); builder.append(""+tc.getName()+""); + builder.append(""+tc.getPlatform()+""); builder.append(""+tc.getTestProjectId()+""); builder.append(""+TestLinkHelper.getExecutionStatusTextColored( tc.getExecutionStatus() )+"\n"); diff --git a/src/main/resources/hudson/plugins/testlink/util/Messages.properties b/src/main/resources/hudson/plugins/testlink/util/Messages.properties index 67f6d8d..dd886cd 100644 --- a/src/main/resources/hudson/plugins/testlink/util/Messages.properties +++ b/src/main/resources/hudson/plugins/testlink/util/Messages.properties @@ -67,5 +67,6 @@ ReportSummary.Details.TestCaseId=Test case ID ReportSummary.Details.TestCaseExternalId=Test case external ID ReportSummary.Details.Version=Version ReportSummary.Details.Name=Name +ReportSummary.Details.Platform=Platform ReportSummary.Details.TestProjectId=Test project ID ReportSummary.Details.ExecutionStatus=Execution status diff --git a/src/main/resources/hudson/plugins/testlink/util/Messages_en.properties b/src/main/resources/hudson/plugins/testlink/util/Messages_en.properties index 67f6d8d..dd886cd 100644 --- a/src/main/resources/hudson/plugins/testlink/util/Messages_en.properties +++ b/src/main/resources/hudson/plugins/testlink/util/Messages_en.properties @@ -67,5 +67,6 @@ ReportSummary.Details.TestCaseId=Test case ID ReportSummary.Details.TestCaseExternalId=Test case external ID ReportSummary.Details.Version=Version ReportSummary.Details.Name=Name +ReportSummary.Details.Platform=Platform ReportSummary.Details.TestProjectId=Test project ID ReportSummary.Details.ExecutionStatus=Execution status diff --git a/src/main/resources/hudson/plugins/testlink/util/Messages_es.properties b/src/main/resources/hudson/plugins/testlink/util/Messages_es.properties index 0259845..256aed2 100644 --- a/src/main/resources/hudson/plugins/testlink/util/Messages_es.properties +++ b/src/main/resources/hudson/plugins/testlink/util/Messages_es.properties @@ -63,5 +63,6 @@ ReportSummary.Details.TestCaseId=ID del caso de prueba ReportSummary.Details.TestCaseExternalId=ID externo del caso de prueba ReportSummary.Details.Version=Versi\uFFFDn ReportSummary.Details.Name=Nombre +ReportSummary.Details.Platform=Plataforma ReportSummary.Details.TestProjectId=ID del proyecto de prueba ReportSummary.Details.ExecutionStatus=Status de ejecuci\uFFFDn diff --git a/src/main/resources/hudson/plugins/testlink/util/Messages_fr.properties b/src/main/resources/hudson/plugins/testlink/util/Messages_fr.properties index 28469b8..eafe0fe 100644 --- a/src/main/resources/hudson/plugins/testlink/util/Messages_fr.properties +++ b/src/main/resources/hudson/plugins/testlink/util/Messages_fr.properties @@ -16,7 +16,7 @@ TestLinkBuilder.ShowFoundTestResults={0} r\u00e9sultats de test trouv\u00e9s.\n TestLinkBuilder.MergingEnvVars=Fusion des variable d'environnement du build avec les variables de TestLink.\n TestLinkBuilder.FailedToUpdateTL=Echec de la mise \u00e0 jour des r\u00e9sultats de test de TestLink: {0}. TestLinkBuilder.MandatoryProperty=Cette propri\u00e9t\u00e9 est obligatoire. -TestLinkBuilder.PlatformNotFound=Platform {0} not found.\n +TestLinkBuilder.PlatformNotFound=Plate-forme {0} pas trouv\uc3a9.\n Results.LookingForTestResults=Recherche du r\u00e9sutat du cas de test de TestLink.\n Results.ErrorToLookForTestResults=Une erreur est survenue lors de la tentative de r\u00e9cup\u00e9ration des r\u00e9sultats de test: {0} @@ -63,5 +63,6 @@ ReportSummary.Details.TestCaseId=ID du cas de test ReportSummary.Details.TestCaseExternalId=Externe ID du cas de test ReportSummary.Details.Version=Version ReportSummary.Details.Name=Nom +ReportSummary.Details.Platform=Plate-forme ReportSummary.Details.TestProjectId=ID du projet de test ReportSummary.Details.ExecutionStatus=Etat d'ex\u00e9cution diff --git a/src/main/resources/hudson/plugins/testlink/util/Messages_pt.properties b/src/main/resources/hudson/plugins/testlink/util/Messages_pt.properties index 5811be7..9fd83b4 100644 --- a/src/main/resources/hudson/plugins/testlink/util/Messages_pt.properties +++ b/src/main/resources/hudson/plugins/testlink/util/Messages_pt.properties @@ -67,5 +67,6 @@ ReportSummary.Details.TestCaseId=ID do caso de teste ReportSummary.Details.TestCaseExternalId=ID externo do caso de teste ReportSummary.Details.Version=Vers\uFFFDo ReportSummary.Details.Name=Nome +ReportSummary.Details.Platform=Plataforma ReportSummary.Details.TestProjectId=ID do projeto de teste ReportSummary.Details.ExecutionStatus=Status de execu\uFFFD\uFFFDo