Class TptPlugin

  • All Implemented Interfaces:
    ExtensionPoint, Describable<Builder>, BuildStep, SimpleBuildStep

    public class TptPlugin
    extends Builder
    implements SimpleBuildStep
    This class is just a data container for the TPTPlugin configuration in Jenkins.
    If you use this Jenkins plugin you have two Options to run TPT-Test. The first option is just to run TPT via command line and execute the tests. The second option is to execute the tests via API. In this case for every testcase a single slave job will be started. This slvae job must have a proper configured TptPluginSlave Build step. Master-slave execution was was introduced in the year 2016.
    • Constructor Detail

      • TptPlugin

        @DataBoundConstructor
        public TptPlugin​(java.lang.String exePaths,
                         java.util.ArrayList<JenkinsConfiguration> executionConfiguration)
        All the parameter are processed and then they are passed to TptPluginSingleJobExecutor or to TptPluginMasterJobExecutor
        Parameters:
        exePaths - paths to tpt executables separated by a comma or a semicolon
        executionConfiguration - all the jenkins configurations given in the descriptor, used to get the Files,Execution Configuration, test Set, testDataDir, reportDir,etc
    • Method Detail

      • readResolve

        protected java.lang.Object readResolve()
        This method is used to persist the data format when upgrading the plugin.
        Returns:
        this
      • getExePaths

        public java.lang.String getExePaths()
        Returns:
        The list of paths to possible TPT-installations.
      • setExe

        @Deprecated
        public void setExe​(java.lang.String exe)
        Deprecated.
        Deprecated, use exePaths instead
        Parameters:
        exe - The path to the tpt.exe
      • getIsTptMaster

        public boolean getIsTptMaster()
        Returns:
        Should testcase execution be delegated to a sub job
      • setIsTptMaster

        @DataBoundSetter
        public void setIsTptMaster​(boolean isTptMaster)
        Should testcase execution be delegated to a sub job or is this run as a single job.
        Parameters:
        isTptMaster - true if the execution should be
      • isIsTptMaster

        public boolean isIsTptMaster()
        Returns:
        Should testcase execution be deligated to a slave job
      • getSlaveJob

        public java.lang.String getSlaveJob()
        Returns:
        The name of slave job if the plugin runs in master mode
      • setSlaveJob

        @DataBoundSetter
        public void setSlaveJob​(java.lang.String slaveJob)
        Parameters:
        slaveJob - The name of slave job if the plugin runs in master mode
      • getSlaveJobCount

        public java.lang.String getSlaveJobCount()
        Returns:
        The number of slave job the plugin will run in master mode. A value below 1 means every test case will be started in its own job.
      • setSlaveJobCount

        @DataBoundSetter
        public void setSlaveJobCount​(java.lang.String slaveJobCount)
        Parameters:
        slaveJobCount - The number of slave job the plugin will run in master mode. A value below 1 means every test case will be started in its own job.
      • getSlaveJobTries

        public java.lang.String getSlaveJobTries()
        Returns:
        If the execution of a slave job fails it is possible to reschedule the job for another try. This is the maximal number of tries.
      • setSlaveJobTries

        @DataBoundSetter
        public void setSlaveJobTries​(java.lang.String slaveJobTries)
        Parameters:
        slaveJobTries - If the execution of a slave job fails it is possible to reschedule the job for another try. This is the maximal number of tries.
      • getTptBindingName

        public java.lang.String getTptBindingName()
        Returns:
        the RMI binding name for TPT
      • setTptBindingName

        @DataBoundSetter
        public void setTptBindingName​(java.lang.String tptBindingName)
        Parameters:
        tptBindingName - The RMI binding name for TPT
      • getTptPort

        public java.lang.String getTptPort()
        Returns:
        The port of the RMI registry
      • setTptPort

        @DataBoundSetter
        public void setTptPort​(java.lang.String tptPort)
        Parameters:
        tptPort - The port of the RMI registry
      • getArguments

        public java.lang.String getArguments()
        Common command line opts. Delimiter between the options is one or more spaces. Inside doublequotes spaces have no special meaning.
        Returns:
        0 or more options for tpt.
      • setArguments

        @DataBoundSetter
        public void setArguments​(java.lang.String arguments)
      • getTptStartUpWaitTime

        public java.lang.String getTptStartUpWaitTime()
        Returns:
        The time waited before trying to get the API handle after starting TPT
      • setTptStartUpWaitTime

        @DataBoundSetter
        public void setTptStartUpWaitTime​(java.lang.String tptStartUpWaitTime)
        Parameters:
        tptStartUpWaitTime - the time waited before trying to get the API handle after starting TPT
      • getExecutionConfiguration

        public java.util.List<JenkinsConfiguration> getExecutionConfiguration()
        Returns:
        List of all (repeatable) sub-configurations
      • isEnableJunit

        public boolean isEnableJunit()
        Returns:
        if the TPT test result should be transformed into a JUnit XML (legacy behaviour)
      • setEnableJunit

        @DataBoundSetter
        public void setEnableJunit​(boolean enableJunit)
        Parameters:
        enableJunit - if the TPT test result should be transformed into a JUnit XML (legacy behaviour)
      • getJUnitreport

        public java.lang.String getJUnitreport()
        Report dir (optional).
        Returns:
        The directory, where to store the results, can be null.
      • setjUnitreport

        @DataBoundSetter
        public void setjUnitreport​(java.lang.String jUnitreport)
        Parameters:
        jUnitreport - The directory, where to store the results, can be null.
      • getJUnitLogLevel

        public com.piketec.jenkins.plugins.tpt.TptLog.LogLevel getJUnitLogLevel()
        The severity level of TPT log messages that will be written to failed JUnit tests.
        Returns:
        The severity level of TPT log messages that will be written to failed JUnit tests.
      • setjUnitLogLevel

        @DataBoundSetter
        public void setjUnitLogLevel​(com.piketec.jenkins.plugins.tpt.TptLog.LogLevel jUnitLogLevel)
        Parameters:
        jUnitLogLevel - The severity level of TPT log messages that will be written to failed JUnit tests.
      • perform

        public void perform​(Run<?,​?> run,
                            FilePath workspace,
                            EnvVars env,
                            Launcher launcher,
                            TaskListener listener)
                     throws java.lang.InterruptedException,
                            java.io.IOException
        Specified by:
        perform in interface SimpleBuildStep
        Throws:
        java.lang.InterruptedException
        java.io.IOException
      • performWithoutSlaves

        public boolean performWithoutSlaves​(Run<?,​?> run,
                                            FilePath workspace,
                                            Launcher launcher,
                                            TaskListener listener,
                                            EnvVars environment,
                                            java.util.ArrayList<JenkinsConfiguration> configs)
                                     throws java.lang.InterruptedException,
                                            java.io.IOException
        Get the required data to create a TptPluginSingleJobExecutor and excecutes it. It is called when there are no distributed builds. All the parameters are used to get the data for creating a new TptPluginSingleJobExecutor
        Parameters:
        run - The current Jenkins build
        launcher - The launcher
        listener - The listener
        environment - The map of envrionment varibales and their value
        configs - The configs with unresolved $-variables
        Returns:
        true if it was possible to execute the TptPluginSingleJobExecutor.
        Throws:
        java.lang.InterruptedException - If thread was interrupted
        java.io.IOException
      • performAsMaster

        public boolean performAsMaster​(Run<?,​?> build,
                                       FilePath workspace,
                                       Launcher launcher,
                                       TaskListener listener,
                                       EnvVars environment,
                                       java.util.ArrayList<JenkinsConfiguration> configs)
                                throws java.lang.InterruptedException
        Get the required data to create a TptPluginMasterJobExecutor and excecutes it. It is called when there are distributed builds. @see the execute() method from TptPluginMasterJobExecutor. All the parameters are used to get the data for creating a new TptPluginMasterJobExecutor
        Parameters:
        build - The current Jenkins build
        launcher - The launcher
        listener - The listener
        environment - The map of envrionment varibales and their value
        configs - The configs with unresolved $-variables
        Returns:
        true if the execution from slaves and master were successful.
        Throws:
        java.lang.InterruptedException - If thread was interrupted