Launch TestPartner from VBscript or any other tool

Share this post
FaceBook  Twitter  Mixx.mn     

' VB Script Document
option explicit
To launch TestPartner from VBscript or any other tool, use following code:
Steps:
1) Create a TestPartner application

2) Login to Testpartner

3) Make TestPartner visible

4) Connect to a Project

5) Open a script and execute

6) Wait until testpartner is executing script

7) Check results

8) Stop script.


        Dim tp 'As testpartner Object
        Dim proj 'As project Object
        Dim scr 'As script Object
         Dim Username, Password, Databasename, Projectname , Scriptname

'1) Create a TestPartner application
'
       Set tp = CreateObject("TestPartner.Application") 'create an instance of TestPartner

'2) Login to Testpartner

        tp.Login Username, Password, Databasename, True    'provide TestPartner login, password and database name details
'3) Make TestPartner visible'
        tp.show() 'show TestPartner App

'4) Connect to a Project'
        Set proj = tp.Projects.Item(Projectname) 'select project

        tp.show()

'5) Open a script and execute'
        Set scr = proj.Scripts.Item(Scriptname) 'select script

        scr.Open() 'open script

        scr.Execute() 'execute script
 
 '6) Wait until testpartner is executing script
        ' check every second if script is still running
        While tp.PlaybackInProgress

        Wend

'7) Check results
        ' show script result in a message box
        MsgBox(tp.LastResult.ChecksPassed & "/" & tp.LastResult.ChecksExecuted)

'8) Stop script.'
        tp.stop()