public final class TestLinkHelper extends Object
Modifier and Type | Method and Description |
---|---|
static void |
addCustomFieldEnvironmentVariableName(br.eti.kinoshita.testlinkjavaapi.model.CustomField customField,
Map<String,String> testLinkEnvVar,
String prefix)
Formats a custom field into an environment variable.
|
static hudson.EnvVars |
buildTestCaseEnvVars(int numberOfTests,
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 TestLink entities.
|
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 String[] |
createArrayOfCustomFieldsNames(hudson.util.VariableResolver<String> variableResolver,
hudson.EnvVars envVars,
String customFields)
Create an array of custom fields names using the Job configuration data.
|
static String |
createReportSummary(Report testLinkReport,
Report previous)
Creates Report Summary.
|
static String |
createReportSummaryDetails(Report report,
Report previous)
Creates detailed Report Summary.
|
static Map<String,String> |
createTestLinkEnvironmentVariables(int numberOfTests,
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 Map<String,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 String |
expandVariable(hudson.util.VariableResolver<String> variableResolver,
hudson.EnvVars envVars,
String variable)
Expands a text variable like BUILD-$VAR replacing the $VAR part with a environment variable that matches its
name, minus $.
|
static 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 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(String systemProperty,
hudson.model.BuildListener listener)
Maybe adds a system property if it is in format (@code key=value}.
|
static void |
setTestLinkJavaAPIProperties(String testLinkJavaAPIProperties,
hudson.model.BuildListener listener)
Defines TestLink Java API Properties.
|
public static String getExecutionStatusTextColored(br.eti.kinoshita.testlinkjavaapi.constants.ExecutionStatus executionStatus)
executionStatus
- the execution status.public static void setTestLinkJavaAPIProperties(String testLinkJavaAPIProperties, hudson.model.BuildListener listener)
Defines TestLink Java API Properties. Following is the list of available properties.
testLinkJavaAPIProperties
- listener
- Jenkins Build listenerpublic static void maybeAddSystemProperty(String systemProperty, hudson.model.BuildListener listener)
systemProperty
- System property entry in format key=value
.listener
- Jenkins Build listenerpublic static Map<String,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)
testCase
- TestLink test Case.testProject
- TestLink Test Project.testPlan
- TestLink Test Plan.build
- TestLink Build.public static Map<String,String> createTestLinkEnvironmentVariables(int numberOfTests, br.eti.kinoshita.testlinkjavaapi.model.TestProject testProject, br.eti.kinoshita.testlinkjavaapi.model.TestPlan testPlan, br.eti.kinoshita.testlinkjavaapi.model.Build build)
testProject
- TestLink Test Project.testPlan
- TestLink Test Plan.build
- TestLink Build.public static void addCustomFieldEnvironmentVariableName(br.eti.kinoshita.testlinkjavaapi.model.CustomField customField, Map<String,String> testLinkEnvVar, String prefix)
Formats a custom field into an environment variable. It appends the ${prefix} in front of the environment variable name.
So, for example, the custom field which name is Sample Custom Field, value is Sample Value, and prefix is TESTLINK_TESTCASE. It 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, value is Sample Value 1, Sample Value 2, and prefix is TESTLINK_TESTCASE. It 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".
customField
- The custom fieldtestLinkEnvVar
- TestLink envVarsprefix
- the variables name prefixpublic 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)
testCase
- TestLink test CasetestProject
- TestLink Test ProjecttestPlan
- TestLink Test Planbuild
- TestLink Buildlistener
- Hudson Build Listenerpublic static hudson.EnvVars buildTestCaseEnvVars(int numberOfTests, 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)
numberOfTests
- number of teststestProject
- TestLink Test ProjecttestPlan
- TestLink Test Planbuild
- TestLink Buildlistener
- Hudson Build Listenerpublic static String createReportSummary(Report testLinkReport, Report previous)
testLinkReport
- TestLink Reportprevious
- Previous TestLink Reportpublic static String createReportSummaryDetails(Report report, Report previous)
report
- TestLink reportprevious
- Previous TestLink reportpublic static String getPlusSignal(int current, int previous)
current
- Current valueprevious
- Previous valuepublic static String[] createArrayOfCustomFieldsNames(hudson.util.VariableResolver<String> variableResolver, hudson.EnvVars envVars, String customFields)
variableResolver
- Jenkins variable resolverenvVars
- Jenkins environment variablescustomFields
- String containinig a comma separated list of custom fieldspublic static String expandVariable(hudson.util.VariableResolver<String> variableResolver, hudson.EnvVars envVars, String variable)
variableResolver
- Jenkins Build Variable Resolver.envVars
- Jenkins Build Environment Variables.variable
- Variable value (includes mask).Copyright © 2010–2019 Jenkins. All rights reserved.