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.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.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 failedTestsMarkBuildAsFailure, java.util.List<ResultSeeker> resultSeekers)
          This constructor is bound to a stapler request.
 
Method Summary
protected  java.lang.String[] createArrayOfCustomFieldsNames(hudson.util.VariableResolver<java.lang.String> variableResolver, hudson.EnvVars envVars)
          Creates array of custom fields names using the Job configuration data.
 java.lang.String expandVariable(hudson.util.VariableResolver<java.lang.String> variableResolver, hudson.EnvVars envVars, java.lang.String variable)
          Expands a text variable like BUILD-$VAR replacing the $VAR part with a environment variable that matches its name, minus $.
 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 getFailedTestsMarkBuildAsUnstable()
           
 java.util.List<hudson.tasks.BuildStep> getIterativeBuildSteps()
           
 hudson.model.Action getProjectAction(hudson.model.AbstractProject<?,?> project)
           
 java.util.List<ResultSeeker> getResultSeekers()
           
 java.util.List<hudson.tasks.BuildStep> getSingleBuildSteps()
           
 java.lang.String getTestLinkName()
           
 java.lang.String getTestPlanName()
           
 java.lang.String getTestProjectName()
           
 java.lang.Boolean getTransactional()
          Returns whether it is a transactional build or not.
 void setResultSeekers(java.util.List<ResultSeeker> resultSeekers)
           
 
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.


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.


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.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 failedTestsMarkBuildAsFailure,
                               java.util.List<ResultSeeker> resultSeekers)
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.
keyCustomField - Key custom field.
singleBuildSteps - List of build steps to execute once for all automated test cases.
beforeIteratingAllTestCasesBuildSteps - Command executed before iterating all test cases.
iterativeBuildSteps - List of build steps to execute for each Automated Test Case.
afterIteratingAllTestCasesBuildSteps - Command executed after iterating all test cases.
transactional - Whether the build's execution is transactional or not.
failedTestsMarkBuildAsFailure - Whether failed tests mark the build as failure or not.
resultSeekers - List of result seekers.
Method Detail

getTestLinkName

public java.lang.String getTestLinkName()

getTestProjectName

public java.lang.String getTestProjectName()

expandVariable

public java.lang.String expandVariable(hudson.util.VariableResolver<java.lang.String> variableResolver,
                                       hudson.EnvVars envVars,
                                       java.lang.String variable)
Expands a text variable like BUILD-$VAR replacing the $VAR part with a environment variable that matches its name, minus $.

Parameters:
variableResolver - Jenkins Build Variable Resolver.
envVars - Jenkins Build Environment Variables.
variable - Variable value (includes mask).
Returns:
Expanded test project name job configuration property.

getTestPlanName

public java.lang.String getTestPlanName()

getBuildName

public java.lang.String getBuildName()

getCustomFields

public java.lang.String getCustomFields()

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

getFailedTestsMarkBuildAsUnstable

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

getResultSeekers

public java.util.List<ResultSeeker> getResultSeekers()
Returns:
the resultSeekers

setResultSeekers

public void setResultSeekers(java.util.List<ResultSeeker> resultSeekers)
Parameters:
resultSeekers - the resultSeekers to set

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(hudson.util.VariableResolver<java.lang.String> variableResolver,
                                                            hudson.EnvVars envVars)
Creates array of custom fields names using the Job configuration data.

Parameters:
variableResolver - Jenkins variable resolver
envVars - Jenkins environment variables
Returns:
Array of custom fields names.


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