Interface TptApi

  • All Superinterfaces:
    java.rmi.Remote, TptRemote

    public interface TptApi
    extends TptRemote
    Main entry point for the access to TPT via the TPT API. This API can be accessed via API Script editor or via Java RMI.
    • Method Detail

      • closeTpt

        boolean closeTpt()
                  throws java.rmi.RemoteException
        Close the TPT instance represented by this object.
        Returns:
        false if the application cannot be closed. Possible reasons are:
        • the user interrupts the close operation
        • a test is currently running and is not been canceled
        • other blocking operations prevent TPT from closing
        Throws:
        java.rmi.RemoteException - remote communication problem
      • openProject

        OpenResult openProject​(java.io.File f)
                        throws ApiException,
                               java.rmi.RemoteException
        Try to open an already existing project and to return a handle for the project (OpenResult.getProject()). If the project is already open, only the handle will be returned. The project is not re-opened. Changes will not been overwritten.

        Any errors or warnings that occur during the open-operation are stored in the OpenResult.getLogs().

        Parameters:
        f - The path to the TPT-file as File
        Returns:
        A OpenResult containing the handle to the project and the log messages occurred during the open-operation.
        Throws:
        java.rmi.RemoteException - remote communication problem
        ApiException - If f do not exists or if f is not a TPT-file.
      • openProjectByPath

        OpenResult openProjectByPath​(java.lang.String f)
                              throws ApiException,
                                     java.rmi.RemoteException
        Try to open an already existing project and to return a handle for the project (OpenResult.getProject()). If the project is already open, only the handle will be returned. The project is not re-opened. Changes will not been overwritten.

        Any errors or warnings that occur during the open-operation are stored in the OpenResult.getLogs().

        Parameters:
        f - The path to the TPT-file
        Returns:
        A OpenResult containing the handle to the project and the log messages occurred during the open-operation.
        Throws:
        java.rmi.RemoteException - remote communication problem
        ApiException - If f do not exists or if f is not a TPT-file.
      • newProject

        Project newProject​(java.io.File f)
                    throws ApiException,
                           java.rmi.RemoteException
        Create a new TPT Project assigned with the given File. The new Project will not be saved during this operation. The given file is only relevant for later save operations.
        Parameters:
        f - the file to use for this project
        Returns:
        the newly created TPT project
        Throws:
        java.rmi.RemoteException - remote communication problem
        ApiException - If the given File is already opened in TPT
        See Also:
        Project.saveProject(), Project.saveAsProject(File)
      • newProjectByPath

        Project newProjectByPath​(java.lang.String f)
                          throws ApiException,
                                 java.rmi.RemoteException
        Create a new TPT Project assigned with the given File. The new Project will not be saved during this operation. The given file is only relevant for later save operations.
        Parameters:
        f - the path to the file to use for this project
        Returns:
        the newly created TPT project
        Throws:
        java.rmi.RemoteException - remote communication problem
        ApiException - If the given File is already opened in TPT
        See Also:
        Project.saveProject(), Project.saveAsProject(File)
      • getOpenProjects

        java.util.Collection<Project> getOpenProjects()
                                               throws java.rmi.RemoteException
        Returns:
        Returns the set of all Projects that are currently open in this TPT instance.
        Throws:
        java.rmi.RemoteException - remote communication problem
      • getTptVersion

        java.lang.String getTptVersion()
                                throws java.rmi.RemoteException
        Returns:
        Returns the version name of the TPT instance represented by this API object.
        Throws:
        java.rmi.RemoteException - remote communication problem
      • getTptInstallationDir

        java.io.File getTptInstallationDir()
                                    throws java.rmi.RemoteException
        Returns:
        Returns the installation directory of the TPT instance represented by this API object.
        Throws:
        java.rmi.RemoteException - remote communication problem
      • getTptInstallationDirPath

        java.lang.String getTptInstallationDirPath()
                                            throws java.rmi.RemoteException
        Returns:
        Returns the absolute path to the installation directory of the TPT instance represented by this API object.
        Throws:
        java.rmi.RemoteException - remote communication problem
      • getFileFormatVersion

        int getFileFormatVersion()
                          throws java.rmi.RemoteException
        Returns:
        Returns the version number of file format this TPT version will use to store *.tpt-, *.tptz- and *.tptprj-Files when calling save.
        Throws:
        java.rmi.RemoteException - remote communication problem
      • run

        ExecutionStatus run​(ExecutionConfiguration config)
                     throws ApiException,
                            java.rmi.RemoteException
        Starts a run for the given ExecutionConfiguration. The test run is started asynchronously. The progress of the test run can be monitored via the returned ExecutionStatus object.
        Parameters:
        config - The ExecutionConfiguration to be executed.
        Returns:
        The state of execution for all test cases defined in the ExecutionConfiguration
        Throws:
        ApiException - if there is already a running test execution or if the test execution could not be started
        java.rmi.RemoteException - If config is not part of the TPT instance represented by this object.
      • reGenerateOverviewReport

        ExecutionStatus reGenerateOverviewReport​(ExecutionConfiguration config)
                                          throws ApiException,
                                                 java.rmi.RemoteException
        Start the generation of the overview report. The generation is done asynchronously.

        This function does not execute or asses the test cases specified in config. It uses the existing result data and XML-files to generate a new overview report.

        Parameters:
        config - The ExecutionConfiguration for which the overview report should be generated.
        Returns:
        the current status of report generation
        Throws:
        ApiException - if there is already a running test execution or if the test execution could not be started
        java.rmi.RemoteException - If config is not part of the TPT instance represented by this object.
      • select

        void select​(IdentifiableRemote obj)
             throws java.rmi.RemoteException,
                    ApiException
        Selects the object given by obj within the TPT GUI - if it is selectable (like a Scenario or an Assessment)
        Parameters:
        obj - A object that implements the IdentifiableRemote interface
        Throws:
        java.rmi.RemoteException - remote communication problem
        ApiException - This method is not supported if the API is running in headless mode
      • getSelectedProject

        Project getSelectedProject()
                            throws java.rmi.RemoteException
        Returns the selected TPT Project or null if no project is selected.
        Returns:
        The selected TPT project or null
        Throws:
        java.rmi.RemoteException - remote communication problem
      • getSelectedTestlet

        Testlet getSelectedTestlet()
                            throws java.rmi.RemoteException
        Returns the selected Testlet or null if no testlet is selected.
        Returns:
        The selected testlet or null
        Throws:
        java.rmi.RemoteException - remote communication problem
      • getSelectedScenarios

        java.util.Collection<Scenario> getSelectedScenarios​(boolean traverseSelectedGroups)
                                                     throws java.rmi.RemoteException
        Returns the selected scenarios. If scenarios and/or scenario groups are selected, groups are irgnored if traverseSelectedGroups is false. If traverseSelectedGroups is true all scenarios contained recursivley in the selected groups are returned as well.
        Parameters:
        traverseSelectedGroups - true if scenarios contained in selected groups shall be returned false if selected groups shall be ignored.
        Returns:
        The selected scenarios
        Throws:
        java.rmi.RemoteException - remote communication problem
      • getSelectedScenarioGroups

        java.util.Collection<ScenarioGroup> getSelectedScenarioGroups()
                                                               throws java.rmi.RemoteException
        Retruns the explicitly selected scenario groups. If only scenarios are selected the returned collection will be empty.
        Returns:
        The explicitly selected scenario groups
        Throws:
        java.rmi.RemoteException - remote communication problem
      • getSelectedAssessments

        java.util.Collection<Assessment> getSelectedAssessments​(boolean traverseSelectedGroups)
                                                         throws java.rmi.RemoteException
        Returns the selected assessments. If assessments and/or assessment groups are selected, groups are irgnored if traverseSelectedGroups is false. If traverseSelectedGroups is true all assessments contained recursivley in the selected groups are returned as well.
        Parameters:
        traverseSelectedGroups - true if assessments contained in selected groups shall be returned false if selected groups shall be ignored.
        Returns:
        The selected assessmentss
        Throws:
        java.rmi.RemoteException - remote communication problem
      • getSelectedAssessmentGroups

        java.util.Collection<AssessmentGroup> getSelectedAssessmentGroups()
                                                                   throws java.rmi.RemoteException
        Retruns the explicitly selected assessment groups. If only assessments are selected the returned collection will be empty.
        Returns:
        The explicitly selected scenario groups
        Throws:
        java.rmi.RemoteException - remote communication problem
      • isReady

        boolean isReady()
                 throws java.rmi.RemoteException
        Depending on its configuration, TPT requires some time to load all plugins. Since the API is one of the first plugins that are loaded, it can be accessed before TPT is actually fully loaded.

        This function returns true as soon as all plugins have been completely loaded and TPT is ready for use.

        Returns:
        Whether TPT has finished its startup
        Throws:
        java.rmi.RemoteException - remote communication problem
      • toFront

        void toFront()
              throws java.rmi.RemoteException
        Bring the TPT main window to the front.
        Throws:
        java.rmi.RemoteException - remote communication problem
      • getToolbox

        UtilToolbox getToolbox()
                        throws java.rmi.RemoteException
        Returns:
        Returns the "toolbox" which contains a set of auxillary functions which are not directly related to a Project or the TPT-Application.
        Throws:
        java.rmi.RemoteException - remote communication problem
      • walkAssessments

        java.lang.Iterable<WalkResult<AssessmentOwner,​AssessmentGroup,​Assessment>> walkAssessments​(AssessmentOwner root)
                                                                                                        throws java.rmi.RemoteException
        Traverses the assessment tree and returns a triple consisting of the current root, a list of assessment groups and a list of assessments under the current root.
        Parameters:
        root - The node where the iterator should start, this can either be the project itself or an assessment group.
        Returns:
        Iterable
        Throws:
        java.rmi.RemoteException - remote communication problem
      • walkTestSets

        java.lang.Iterable<WalkResult<TestSetOwner,​TestSetGroup,​TestSet>> walkTestSets​(TestSetOwner root)
                                                                                            throws java.rmi.RemoteException
        Traverses the test set tree and returns a triple consisting of the current root, a list of test set groups and a list of test sets under the current root.
        Parameters:
        root - The node where the iterator should start, this can either be the project itself or a test set group.
        Returns:
        Iterable
        Throws:
        java.rmi.RemoteException - remote communication problem
      • walkExecutionConfigurations

        java.lang.Iterable<WalkResult<ExecutionConfigurationOwner,​ExecutionConfigurationGroup,​ExecutionConfiguration>> walkExecutionConfigurations​(ExecutionConfigurationOwner root)
                                                                                                                                                        throws java.rmi.RemoteException
        Traverses the execution configuration tree and returns a triple consisting of the current root, a list of execution configuration groups and a list of execution configurations under the current root.
        Parameters:
        root - The node where the iterator should start, this can either be the project itself or an execution configuration group.
        Returns:
        Iterable
        Throws:
        java.rmi.RemoteException - remote communication problem
      • walkScenarios

        java.lang.Iterable<WalkResult<ScenarioGroup,​ScenarioGroup,​Scenario>> walkScenarios​(ScenarioGroup root)
                                                                                                throws java.rmi.RemoteException
        Traverses the scenario tree and returns a triple consisting of the current root, a list of scenario groups and a list of scenarios under the current root.
        Parameters:
        root - The scenario group where the iterator should start.
        Returns:
        Iterable
        Throws:
        java.rmi.RemoteException - remote communication problem
      • walkTestlets

        java.lang.Iterable<WalkResult<Testlet,​Testlet,​Testlet>> walkTestlets​(Testlet root)
                                                                                  throws java.rmi.RemoteException
        Traverses the testlet tree and returns a triple consisting of the current root, a list of testlets under the current root and as the third component an empty list.
        Parameters:
        root - The testlet where the iterator should start. Note, you can use Project.getTopLevelTestlet() to start traversing from the top of the testlet tree.
        Returns:
        Iterable
        Throws:
        java.rmi.RemoteException - remote communication problem
      • getExecutionStatus

        ExecutionStatus getExecutionStatus​(ExecutionConfiguration config)
                                    throws ApiException,
                                           java.rmi.RemoteException
        Gets the ExecutionStatus of all test cases defined in the given ExecutionConfiguration.
        Parameters:
        config - The ExecutionConfiguration for which execution status should be verified.
        Returns:
        The state of execution for all test cases defined in the ExecutionConfiguration or null if there is no active execution.
        Throws:
        ApiException - If there is no builder matching this configuration.
        java.rmi.RemoteException - If config is not part of the TPT instance represented by this object.