Class TptApiAccess


  • public class TptApiAccess
    extends java.lang.Object
    Since the TPT API should be used only on the localshost and not via a remote connection, all API calls are done within Callables. This class provides utility methods to start the Callables.
    • Constructor Summary

      Constructors 
      Constructor Description
      TptApiAccess​(Launcher launcher, TptLogger logger, FilePath[] exePaths, java.util.List<java.lang.String> arguments, int tptPort, java.lang.String tptBindingName, long tptStartupWaitTime)
      Provide all information that is needed to establish an TPT API connection.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Boolean executeTestsSlave​(FilePath tptFilePath, java.lang.String executionConfigName, java.lang.String testSetName, FilePath slaveReportPath, FilePath slaveDataPath, java.util.List<java.lang.String> testSetList)
      Executes all test cases named in testSetList as a sub set of the given test set.
      GetTestCasesCallableResult getTestCases​(FilePath tptFilePath, java.lang.String executionConfigName, java.lang.String testSet)
      Get all test cases for the given test set.
      java.lang.Boolean runOverviewReport​(FilePath tptFilePath, java.lang.String executionConfigName, java.lang.String testSet, FilePath reportPath, FilePath testDataPath)
      Creates an overview report for already available test data.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TptApiAccess

        public TptApiAccess​(Launcher launcher,
                            TptLogger logger,
                            FilePath[] exePaths,
                            java.util.List<java.lang.String> arguments,
                            int tptPort,
                            java.lang.String tptBindingName,
                            long tptStartupWaitTime)
        Provide all information that is needed to establish an TPT API connection. This information is needed for any Callable that is called in later methods, so to reduce parameters in these methods, get them here already.
        Parameters:
        launcher - The launcher
        logger - for dumping messages
        exePaths - paths to the tpt.exe files, usually set in the Jenkins UI
        tptPort - port that the TPT API should use to connect.
        tptBindingName - binding name that the TPT API should use to connect.
        tptStartupWaitTime - time that Jenkins waits for TPT to start up if it is not running already
    • Method Detail

      • getTestCases

        @CheckForNull
        public GetTestCasesCallableResult getTestCases​(FilePath tptFilePath,
                                                       java.lang.String executionConfigName,
                                                       java.lang.String testSet)
                                                throws java.lang.InterruptedException
        Get all test cases for the given test set. If the test set is null or empty, the test sets of the execution configuration are evaluated.
        Parameters:
        tptFilePath - tpt file from which to get the test cases
        executionConfigName - execution configuration
        testSet - test set from which to get the test cases
        Returns:
        a list of test case names for the given settings and the total test case count
        Throws:
        java.lang.InterruptedException - If thread was interrupted
      • runOverviewReport

        public java.lang.Boolean runOverviewReport​(FilePath tptFilePath,
                                                   java.lang.String executionConfigName,
                                                   java.lang.String testSet,
                                                   FilePath reportPath,
                                                   FilePath testDataPath)
                                            throws java.lang.InterruptedException
        Creates an overview report for already available test data.
        Parameters:
        tptFilePath - - tpt file for which the overview report should be built
        executionConfigName - - execution configuration that was executed
        testSet - - test set that was executed
        reportPath - - path to the folder where the test case reports can be found and the overview report should be put
        testDataPath - - path to the test data that is needed to build the overview report
        Returns:
        true if the report generation was successful, false otherwise.
        Throws:
        java.lang.InterruptedException - If thread was interrupted
      • executeTestsSlave

        public java.lang.Boolean executeTestsSlave​(FilePath tptFilePath,
                                                   java.lang.String executionConfigName,
                                                   java.lang.String testSetName,
                                                   FilePath slaveReportPath,
                                                   FilePath slaveDataPath,
                                                   java.util.List<java.lang.String> testSetList)
                                            throws java.lang.InterruptedException
        Executes all test cases named in testSetList as a sub set of the given test set.
        Parameters:
        tptFilePath - - tpt file that should be executed
        executionConfigName - - execution configuration that should be executed
        testSetName - - test set that should be executed
        slaveReportPath - - path to where the report shall be put
        slaveDataPath - - path to where the test data shall be put
        testSetList - The list of test cases to execute
        Returns:
        true if the execution was successful, false otherwise.
        Throws:
        java.lang.InterruptedException - If thread was interrupted