hudson.plugins.testlink
Class AbstractTestLinkBuilder

java.lang.Object
  extended by hudson.tasks.BuildStepCompatibilityLayer
      extended by hudson.tasks.Builder
          extended by hudson.plugins.testlink.AbstractTestLinkBuilder
All Implemented Interfaces:
hudson.ExtensionPoint, hudson.model.Describable<hudson.tasks.Builder>, hudson.tasks.BuildStep
Direct Known Subclasses:
TestLinkBuilder

public class AbstractTestLinkBuilder
extends hudson.tasks.Builder

Contains basic logic for a Builder for TestLink plug-in. This class was created to reduce complexity and reduce the length of the code present in the Builder itself.

Since:
2.4
Author:
Bruno P. Kinoshita - http://www.kinoshita.eti.br

Nested Class Summary
 
Nested classes/interfaces inherited from interface hudson.tasks.BuildStep
hudson.tasks.BuildStep.PublisherList
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
hudson.ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Field Summary
protected  java.util.List<hudson.tasks.BuildStep> afterIteratingAllTestCasesBuildSteps
          List of build steps that are executed after iterating all test cases.
protected  java.util.List<hudson.tasks.BuildStep> beforeIteratingAllTestCasesBuildSteps
          List of build steps that are executed before iterating all test cases.
protected  java.lang.String buildName
          The name of the Build.
protected  java.lang.String customFields
          Comma separated list of custom fields to download from TestLink.
protected  ExecutionOrderComparator executionOrderComparator
          Used to sort test cases marked as automated.
protected  java.lang.Boolean failedTestsMarkBuildAsFailure
          If the plug-in should mark the Build in Jenkins as failure if it contains failed tests.
protected  boolean failure
          Flag to check if any failure happened.
protected  java.util.List<hudson.tasks.BuildStep> iterativeBuildSteps
          List of build steps that are executed for each test case.
protected  java.lang.String keyCustomField
          Name of the Key Custom Field.
protected  ReportFilesPatterns reportFilesPatterns
          Report files patterns.
protected  java.util.List<hudson.tasks.BuildStep> singleBuildSteps
          List of build steps that are executed only once per job execution.
protected  java.lang.String testLinkName
          The name of the TestLink installation.
protected  java.lang.String testPlanName
          The name of the Test Plan.
protected  java.lang.String testProjectName
          The name of the Test Project.
protected  java.lang.Boolean transactional
          If this property is true, not more build steps are executed for this Build.
 
Fields inherited from interface hudson.tasks.BuildStep
BUILDERS, PUBLISHERS
 
Constructor Summary
AbstractTestLinkBuilder(java.lang.String testLinkName, java.lang.String testProjectName, java.lang.String testPlanName, java.lang.String buildName, java.lang.String customFields, java.lang.String keyCustomField, java.util.List<hudson.tasks.BuildStep> singleBuildSteps, java.util.List<hudson.tasks.BuildStep> beforeIteratingAllTestCasesBuildSteps, java.util.List<hudson.tasks.BuildStep> iterativeBuildSteps, java.util.List<hudson.tasks.BuildStep> afterIteratingAllTestCasesBuildSteps, java.lang.Boolean transactional, java.lang.Boolean failedTestsMarkBuildAsUnstable, java.lang.String junitXmlReportFilesPattern, java.lang.String testNGXmlReportFilesPattern, java.lang.String tapStreamReportFilesPattern)
          This constructor is bound to a stapler request.
 
Method Summary
protected  java.lang.String[] createArrayOfCustomFieldsNames()
          Creates array of custom fields names using the Job configuration data.
 java.lang.String expandBuildName(hudson.util.VariableResolver<java.lang.String> variableResolver, hudson.EnvVars envVars)
          Expands build name job configuration property, replacing environment variables with Jenkins+System values.
 java.lang.String expandTestPlanName(hudson.util.VariableResolver<java.lang.String> variableResolver, hudson.EnvVars envVars)
          Expands test plan name job configuration property, replacing environment variables with Jenkins+System values.
 java.lang.String expandTestProjectName(hudson.util.VariableResolver<java.lang.String> variableResolver, hudson.EnvVars envVars)
          Expands test project name job configuration property, replacing environment variables with Jenkins+System values.
 java.util.List<hudson.tasks.BuildStep> getAfterIteratingAllTestCasesBuildSteps()
           
 java.util.List<hudson.tasks.BuildStep> getBeforeIteratingAllTestCasesBuildSteps()
           
 java.lang.String getBuildName()
           
 java.lang.String getCustomFields()
           
 java.lang.Boolean getFailedTestsMarkBuildAsFailure()
           
 java.util.List<hudson.tasks.BuildStep> getIterativeBuildSteps()
           
 java.lang.String getJunitXmlReportFilesPattern()
           
 java.lang.String getKeyCustomField()
           
 hudson.model.Action getProjectAction(hudson.model.AbstractProject<?,?> project)
           
 ReportFilesPatterns getReportFilesPatterns()
          Returns report files patterns for JUnit, TestNG and TAP.
 java.util.List<hudson.tasks.BuildStep> getSingleBuildSteps()
           
 java.lang.String getTapStreamReportFilesPattern()
           
 java.lang.String getTestLinkName()
           
 java.lang.String getTestNGXmlReportFilesPattern()
           
 java.lang.String getTestPlanName()
           
 java.lang.String getTestProjectName()
           
 java.lang.Boolean getTransactional()
          Returns whether it is a transactional build or not.
 
Methods inherited from class hudson.tasks.Builder
all, getDescriptor, getRequiredMonitorService, prebuild
 
Methods inherited from class hudson.tasks.BuildStepCompatibilityLayer
getProjectAction, getProjectActions, perform, perform, prebuild
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface hudson.tasks.BuildStep
getProjectActions, perform, prebuild
 

Field Detail

testLinkName

protected final java.lang.String testLinkName
The name of the TestLink installation.


testProjectName

protected final java.lang.String testProjectName
The name of the Test Project.


testPlanName

protected final java.lang.String testPlanName
The name of the Test Plan.


buildName

protected java.lang.String buildName
The name of the Build.


customFields

protected final java.lang.String customFields
Comma separated list of custom fields to download from TestLink.


keyCustomField

protected final java.lang.String keyCustomField
Name of the Key Custom Field. This must be one of the custom fields in the property customFields;


singleBuildSteps

protected final java.util.List<hudson.tasks.BuildStep> singleBuildSteps
List of build steps that are executed only once per job execution.


beforeIteratingAllTestCasesBuildSteps

protected final java.util.List<hudson.tasks.BuildStep> beforeIteratingAllTestCasesBuildSteps
List of build steps that are executed before iterating all test cases.


iterativeBuildSteps

protected final java.util.List<hudson.tasks.BuildStep> iterativeBuildSteps
List of build steps that are executed for each test case.


afterIteratingAllTestCasesBuildSteps

protected final java.util.List<hudson.tasks.BuildStep> afterIteratingAllTestCasesBuildSteps
List of build steps that are executed after iterating all test cases.


transactional

protected final java.lang.Boolean transactional
If this property is true, not more build steps are executed for this Build.


failedTestsMarkBuildAsFailure

protected final java.lang.Boolean failedTestsMarkBuildAsFailure
If the plug-in should mark the Build in Jenkins as failure if it contains failed tests.


reportFilesPatterns

protected final ReportFilesPatterns reportFilesPatterns
Report files patterns.


executionOrderComparator

protected final ExecutionOrderComparator executionOrderComparator
Used to sort test cases marked as automated.


failure

protected boolean failure
Flag to check if any failure happened.

Constructor Detail

AbstractTestLinkBuilder

public AbstractTestLinkBuilder(java.lang.String testLinkName,
                               java.lang.String testProjectName,
                               java.lang.String testPlanName,
                               java.lang.String buildName,
                               java.lang.String customFields,
                               java.lang.String keyCustomField,
                               java.util.List<hudson.tasks.BuildStep> singleBuildSteps,
                               java.util.List<hudson.tasks.BuildStep> beforeIteratingAllTestCasesBuildSteps,
                               java.util.List<hudson.tasks.BuildStep> iterativeBuildSteps,
                               java.util.List<hudson.tasks.BuildStep> afterIteratingAllTestCasesBuildSteps,
                               java.lang.Boolean transactional,
                               java.lang.Boolean failedTestsMarkBuildAsUnstable,
                               java.lang.String junitXmlReportFilesPattern,
                               java.lang.String testNGXmlReportFilesPattern,
                               java.lang.String tapStreamReportFilesPattern)
This constructor is bound to a stapler request. All parameters here are passed by Jenkins.

Parameters:
testLinkName - TestLink Installation name.
testProjectName - TestLink Test Project name.
testPlanName - TestLink Test Plan name.
buildName - TestLink Build name.
customFields - TestLink comma-separated list of Custom Fields.
singleBuildSteps - List of build steps to execute once for all automated test cases.
iterativeBuildSteps - List of build steps to execute for each Automated Test Case.
keyCustomField - Automated Test Case key custom field.
transactional - Whether the build's execution is transactional or not.
failedTestsMarkBuildAsUnstable - Whether failed tests mark the build as unstable or not.
junitXmlReportFilesPattern - Pattern for JUnit report files.
testNGXmlReportFilesPattern - Pattern for TestNG report files.
tapStreamReportFilesPattern - Pattern for TAP report files.
beforeIteratingAllTestCasesBuildSteps - Command executed before iterating all test cases.
afterIteratingAllTestCasesBuildSteps - Command executed after iterating all test cases.
Method Detail

getTestLinkName

public java.lang.String getTestLinkName()

getTestProjectName

public java.lang.String getTestProjectName()

expandTestProjectName

public java.lang.String expandTestProjectName(hudson.util.VariableResolver<java.lang.String> variableResolver,
                                              hudson.EnvVars envVars)
Expands test project name job configuration property, replacing environment variables with Jenkins+System values.

Parameters:
variableResolver - Jenkins Build Variable Resolver.
envVars - Jenkins Build Environment Variables.
Returns:
Expanded test project name job configuration property.

getTestPlanName

public java.lang.String getTestPlanName()

expandTestPlanName

public java.lang.String expandTestPlanName(hudson.util.VariableResolver<java.lang.String> variableResolver,
                                           hudson.EnvVars envVars)
Expands test plan name job configuration property, replacing environment variables with Jenkins+System values.

Parameters:
variableResolver - Jenkins Build Variable Resolver.
envVars - Jenkins Build Environment Variables.
Returns:
Expanded test plan name job configuration property.

getBuildName

public java.lang.String getBuildName()

expandBuildName

public java.lang.String expandBuildName(hudson.util.VariableResolver<java.lang.String> variableResolver,
                                        hudson.EnvVars envVars)
Expands build name job configuration property, replacing environment variables with Jenkins+System values.

Parameters:
variableResolver - Jenkins Build Variable Resolver.
envVars - Jenkins Build Environment Variables.
Returns:
Expanded build name job configuration property.

getCustomFields

public java.lang.String getCustomFields()

getKeyCustomField

public java.lang.String getKeyCustomField()

getSingleBuildSteps

public java.util.List<hudson.tasks.BuildStep> getSingleBuildSteps()

getBeforeIteratingAllTestCasesBuildSteps

public java.util.List<hudson.tasks.BuildStep> getBeforeIteratingAllTestCasesBuildSteps()

getIterativeBuildSteps

public java.util.List<hudson.tasks.BuildStep> getIterativeBuildSteps()

getAfterIteratingAllTestCasesBuildSteps

public java.util.List<hudson.tasks.BuildStep> getAfterIteratingAllTestCasesBuildSteps()

getTransactional

public java.lang.Boolean getTransactional()
Returns whether it is a transactional build or not. A transactional build stops executing once a test fails. All tests must succeed or it won't finish its execution and will mark all remaining tests with Blocked status.

Returns:
If the build step should be transactional or not

getFailedTestsMarkBuildAsFailure

public java.lang.Boolean getFailedTestsMarkBuildAsFailure()
Returns:
the failedTestsMarkBuildAsUnstable

getReportFilesPatterns

public ReportFilesPatterns getReportFilesPatterns()
Returns report files patterns for JUnit, TestNG and TAP.

Returns:
Report files patterns.

getJunitXmlReportFilesPattern

public java.lang.String getJunitXmlReportFilesPattern()

getTestNGXmlReportFilesPattern

public java.lang.String getTestNGXmlReportFilesPattern()

getTapStreamReportFilesPattern

public java.lang.String getTapStreamReportFilesPattern()

getProjectAction

public hudson.model.Action getProjectAction(hudson.model.AbstractProject<?,?> project)
Specified by:
getProjectAction in interface hudson.tasks.BuildStep
Overrides:
getProjectAction in class hudson.tasks.BuildStepCompatibilityLayer

createArrayOfCustomFieldsNames

protected java.lang.String[] createArrayOfCustomFieldsNames()
Creates array of custom fields names using the Job configuration data.

Returns:
Array of custom fields names.


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