-
-
Save adityamulik/a80d7dbd29faad6ff475dde6b28fe41a to your computer and use it in GitHub Desktop.
Python script to run a QTP test (Compatible with Python3.10)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import win32com, win32com.client | |
def automate_uft(): | |
""" | |
The script is used to run | |
the automation of Micro Focus UFT app. | |
Modified to run with the latest version of python3. | |
- Author: Aditya Mulik (mulik.a@northeastern.edu) | |
- Credits: GitHub/@bulkan (https://gist.github.com/bulkan/188917) | |
""" | |
# Create UFT Object | |
qtp = win32com.client.Dispatch("QuickTest.Application") | |
# starts up QTP | |
qtp.Launch() | |
# make the QTP window visible | |
qtp.Visible = True | |
# Open a test (Enter path where your test is located) | |
qtp.Open("C:\Group5_UFT_Assignment\Assignment_2_UFT") | |
# create a RunResultsOptions object | |
qtResultsOpt = win32com.client.Dispatch("QuickTest.RunResultsOptions") | |
# set the location to where the results will be saved | |
qtResultsOpt.ResultsLocation = "C:\Group5_UFT_Assignment\Assignment_2_UFT\Results" | |
qtp.Test.Run(qtResultsOpt) | |
print(f"Test has {qtp.Test.LastRunResults.Status}"); | |
# close the Test | |
qtp.Test.Close() | |
# quit QTP | |
qtp.Quit() | |
if __name__ == "__main__": | |
automate_uft() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment