Forum Discussion

AaronBastian's avatar
13 years ago

Using the TestComplete API

Good afternoon,



I am creating .NET application that while using the TestComplete API should start an instance of TestComplete in a specific Project Suite,  and run specific tests in a specific project.  For example, I want to:

- Create a new instance of TestComplete and open it as a background process

  - Open TestSuite1

     - Open TestProject3

       - See a list of Test Items

       - Activate/Deactivate specific Test Items in the said list

       - Run updated TestProject3 

         - Write test success or failure to the test log

             - if test fails, log test item in which the test failed

         - Continue to the next text 

     - Close TestProject3

  - Close TestSuite1

- Dispose of TestComplete instance



For step 1-2, I used the examples given in the API documentation:



Dim TestCompleteObject as TestComplete.TestCompleteApplication = Nothing

Try

            TestCompleteObject =  CType(Runtime.InteropServices.Marshal.GetActiveObject(TCProgID), TestCompleteApplication)

Catch

            Try

                TestCompleteObject = CType(Activator.CreateInstance(Type.GetTypeFromProgID(TCProgID)), TestCompleteApplication

            Catch

            End Try

End Try

If (TestCompleteObject Is Nothing) Then Exit Sub

IntegrationObject.OpenProjectSuite("TestSuite1")

If Not IntegrationObject.IsProjectSuiteOpened Then

    Messagebox.Show("Could not open the project suite.")

    CloseTestComplete()

End If



All of the other steps that I have been trying to complete consist of using TestComplete.Itc....... but it has been a system of trial and error. The online API documentation does not seem to cover these in a manner that I can find with ease.



I have been able to run Projects, but for them to run the project must have Test Items enabled in Test Complete. I want to be able to control what gets run regardless of what test items are enabled.



Has anyone out there had any experience in managing the enabled property of Test Items of a Project? Any help would be greatly appreciated. If you need more information, please let me know. Thank you!