Class TptApiAccess


  • public class TptApiAccess
    extends 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 Detail

      • TptApiAccess

        public TptApiAccess​(Launcher launcher,
                            TptLogger logger,
                            FilePath[] exePaths,
                            List<String> arguments,
                            int tptPort,
                            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,
                                                       String executionConfigName,
                                                       String testSet)
                                                throws 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:
        InterruptedException - If thread was interrupted
      • runOverviewReport

        public Boolean runOverviewReport​(FilePath tptFilePath,
                                         String executionConfigName,
                                         String testSet,
                                         FilePath reportPath,
                                         FilePath testDataPath)
                                  throws 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:
        InterruptedException - If thread was interrupted
      • executeTestsOnWorker

        public Boolean executeTestsOnWorker​(FilePath tptFilePath,
                                            String executionConfigName,
                                            String testSetName,
                                            FilePath workerJobReportPath,
                                            FilePath workerJobDataPath,
                                            List<String> testSetList)
                                     throws 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
        workerJobReportPath - - path to where the report shall be put
        workerJobDataPath - - 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:
        InterruptedException - If thread was interrupted