- 1 year ago
How to generate Test Overview Report in Tessy using Python?
To generate a Test Overview Report in Tessy using Python, you can use the Tessy API to interact with the Tessy project and extract the necessary information.
Here are the high-level steps you can follow:
Import the Tessy API module: The Tessy API is available as a Python module called
tessy_api
. You can import it using the following code:pythonfrom tessy_api import Tessy
Connect to the Tessy project: To interact with the Tessy project, you need to connect to it using the
Tessy
class. You can do this by creating an instance of theTessy
class and passing in the path to the Tessy project file:pythontessy = Tessy("path/to/tessy_project_file.tsy")
Retrieve the Test Overview data: Once you've connected to the Tessy project, you can use the
get_test_overview()
method to retrieve the Test Overview data. This method returns a list of dictionaries, where each dictionary contains information about a single Test Case. You can retrieve this data using the following code:pythontest_overview_data = tessy.get_test_overview()
Process the Test Overview data: Once you have the Test Overview data, you can process it to generate the report. You can use the
csv
module to write the data to a CSV file, and thematplotlib
module to create charts and graphs. Here's some example code to get you started:pythonimport csv
import matplotlib.pyplot as plt
# Write Test Overview data to a CSV file
with open("test_overview.csv", "w", newline="") as csvfile:
writer = csv.writer(csvfile)
writer.writerow(["Test Case ID", "Result"])
for test_case in test_overview_data:
writer.writerow([test_case["ID"], test_case["Result"]])
# Generate a pie chart of the results
results = [test_case["Result"] for test_case in test_overview_data]
labels = list(set(results))
counts = [results.count(label) for label in labels]
plt.pie(counts, labels=labels)
plt.title("Test Results")
plt.show()
This code will write the Test Overview data to a CSV file called
test_overview.csv
, and then generate a pie chart of the results using thematplotlib
module.Run the script: Finally, you can run the Python script to generate the Test Overview Report. You can do this by opening a Command Prompt or terminal window, navigating to the directory where the Python script is saved, and running the command
python script.py
. Make sure to replacescript.py
with the name of your Python script.
By following these steps, you should be able to generate a Test Overview Report in Tessy using Python. Note that you can customize the report to include any additional information that you need.