hudson.plugins.testlink.util
Class TestLinkHelper

java.lang.Object
  extended by hudson.plugins.testlink.util.TestLinkHelper

public final class TestLinkHelper
extends java.lang.Object

Helper methods for TestLink.

Since:
2.0
Author:
Bruno P. Kinoshita

Method Summary
static void addCustomFieldEnvironmentVariableName(br.eti.kinoshita.testlinkjavaapi.model.CustomField customField, java.util.Map<java.lang.String,java.lang.String> testLinkEnvVar)
          Formats a custom field into an environment variable.
static hudson.EnvVars buildTestCaseEnvVars(TestCaseWrapper testCase, br.eti.kinoshita.testlinkjavaapi.model.TestProject testProject, br.eti.kinoshita.testlinkjavaapi.model.TestPlan testPlan, br.eti.kinoshita.testlinkjavaapi.model.Build build, hudson.model.BuildListener listener)
          Creates EnvVars for a TestLink Test Case.
static java.lang.String createReportSummary(Report testLinkReport, Report previous)
          Creates Report Summary.
static java.lang.String createReportSummaryDetails(Report report, Report previous)
          Creates detailed Report Summary.
static java.util.Map<java.lang.String,java.lang.String> createTestLinkEnvironmentVariables(TestCaseWrapper testCase, br.eti.kinoshita.testlinkjavaapi.model.TestProject testProject, br.eti.kinoshita.testlinkjavaapi.model.TestPlan testPlan, br.eti.kinoshita.testlinkjavaapi.model.Build build)
          Creates a Map (name, value) of environment variables for a TestLink Test Case.
static java.lang.String getExecutionStatusTextColored(br.eti.kinoshita.testlinkjavaapi.constants.ExecutionStatus executionStatus)
          Retrieves the text for an execution status wrapped in html tags that add color to the text.
static java.lang.String getPlusSignal(int current, int previous)
          Prints the difference between two int values, showing a plus sign if the current number is greater than the previous.
static void maybeAddSystemProperty(java.lang.String systemProperty, hudson.model.BuildListener listener)
          Maybe adds a system property if it is in format =.
static void setTestLinkJavaAPIProperties(java.lang.String testLinkJavaAPIProperties, hudson.model.BuildListener listener)
          Defines TestLink Java API Properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getExecutionStatusTextColored

public static java.lang.String getExecutionStatusTextColored(br.eti.kinoshita.testlinkjavaapi.constants.ExecutionStatus executionStatus)
Retrieves the text for an execution status wrapped in html tags that add color to the text. Green for sucess, yellow for blocked, gray for not ran and red for failed. If the plug-in supports the locale the text will be translated automatically.

Parameters:
executionStatus - the execution status.
Returns:
the text wrapped in html tags that add color to the text.

setTestLinkJavaAPIProperties

public static void setTestLinkJavaAPIProperties(java.lang.String testLinkJavaAPIProperties,
                                                hudson.model.BuildListener listener)

Defines TestLink Java API Properties. Following is the list of available properties.

Parameters:
testLinkJavaAPIProperties -
listener - Jenkins Build listener

maybeAddSystemProperty

public static void maybeAddSystemProperty(java.lang.String systemProperty,
                                          hudson.model.BuildListener listener)
Maybe adds a system property if it is in format =.

Parameters:
systemProperty - System property entry in format =.
listener - Jenkins Build listener

createTestLinkEnvironmentVariables

public static java.util.Map<java.lang.String,java.lang.String> createTestLinkEnvironmentVariables(TestCaseWrapper testCase,
                                                                                                  br.eti.kinoshita.testlinkjavaapi.model.TestProject testProject,
                                                                                                  br.eti.kinoshita.testlinkjavaapi.model.TestPlan testPlan,
                                                                                                  br.eti.kinoshita.testlinkjavaapi.model.Build build)
Creates a Map (name, value) of environment variables for a TestLink Test Case.

Parameters:
testCase - TestLink test Case.
testProject - TestLink Test Project.
testPlan - TestLink Test Plan.
build - TestLink Build.
Returns:
Map (name, value) of environment variables.

addCustomFieldEnvironmentVariableName

public static void addCustomFieldEnvironmentVariableName(br.eti.kinoshita.testlinkjavaapi.model.CustomField customField,
                                                         java.util.Map<java.lang.String,java.lang.String> testLinkEnvVar)

Formats a custom field into an environment variable. It appends TESTLINK_TESTCASE in front of the environment variable name.

So, for example, the custom field which name is Sample Custom Field and value is Sample Value, will be added into the environment variables as TESTLINK_TESTCASE_SAMPLE__CUSTOM_FIELD="Sample Value" (note for the double spaces).

If the custom's value contains commas (,), then this method splits the value and, for each token found, it creates a new environment variable appending a numeric index after its name

So, for example, the custom field which name is Sample Custom Field and value is Sample Value 1, Sample Value 2, will generate three environment variables: TESTLINK_TESTCASE_SAMPLE_CUSTOM_FIELD="Sample Value 1, Sample Value 2", TESTLINK_TESTCASE_SAMPLE_CUSTOM_FIELD_0="Sample Value 1" and TESTLINK_TESTCASE_SAMPLE_CUSTOM_FIELD_1="Sample Value 2".

Parameters:
customField - The custom field
testLinkEnvVar - TestLink envVars

buildTestCaseEnvVars

public static hudson.EnvVars buildTestCaseEnvVars(TestCaseWrapper testCase,
                                                  br.eti.kinoshita.testlinkjavaapi.model.TestProject testProject,
                                                  br.eti.kinoshita.testlinkjavaapi.model.TestPlan testPlan,
                                                  br.eti.kinoshita.testlinkjavaapi.model.Build build,
                                                  hudson.model.BuildListener listener)
Creates EnvVars for a TestLink Test Case.

Parameters:
testCase - TestLink test Case
testProject - TestLink Test Project
testPlan - TestLink Test Plan
build - TestLink Build
listener - Hudson Build Listener
Returns:
EnvVars (environment variables)

createReportSummary

public static java.lang.String createReportSummary(Report testLinkReport,
                                                   Report previous)
Creates Report Summary.

Parameters:
testLinkReport - TestLink Report
previous - Previous TestLink Report
Returns:
Report Summary

createReportSummaryDetails

public static java.lang.String createReportSummaryDetails(Report report,
                                                          Report previous)
Creates detailed Report Summary.

Parameters:
report - TestLink report
previous - Previous TestLink report
Returns:
Detailed Report Summary

getPlusSignal

public static java.lang.String getPlusSignal(int current,
                                             int previous)
Prints the difference between two int values, showing a plus sign if the current number is greater than the previous.

Parameters:
current - Current value
previous - Previous value


Copyright © 2010-2011 the Jenkins TestLink plug-in team-2012 Jenkins. All Rights Reserved.