cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

Creating Test Session using WebServices

ashish_barco
1-Newbie

Creating Test Session using WebServices

Hi,

 

I was doing some Python based automation of Testcase management and was able to modify test results using SOAP web service calls. Working sample code is pasted below, all you need to provide is proper credentials and change ids in testcases dictionary in python code as per your setup.

 

The only problem is you have to start test session manually before, so that these soap calls can work.

Is there any soap api to start/end test session? Code sample in any language will also help a lot?

 

Thanks,

Ashish 

  

import requests
import base64
from zeep import Client
from zeep.transports import Transport


session = requests.Session()

username = "<your_ptc_login_name>"
password = "<your_ptc_login_passwd>"

client = Client('http://<PTC Server IP>:7001/webservices/10/Test/Schema?WSDL',
transport=Transport(session=session))

 

try:
session_id = 494547

client = Client('http://<PTC Server IP>:7001/webservices/10/Test/Schema?WSDL',
transport=Transport(session=session))

test_cases = {"494537": "PASSED", "494539": "PASSED", "494541": "PASSED",
"494543": "FAILED", "494545": "PASSED"}

print(" ============== EDITING RESULTS ================ ")
for tc, results in test_cases.items():
result = client.service.editResults(
arg0={"Username": username, "Password": password,
"SessionID": session_id, "Verdict": results, "Overwrite": True,
"TestCaseID": int(tc)})
print("Setting ", tc , "result: ", results)

print(" ============== GETTING RESULTS ================ ")
for tc in test_cases:
result = client.service.getResults(
arg0={"Username": username, "Password": password,
"Selections": {"TestCase": int(tc)}})
print(result["Result"][0]["TestCaseID"], result["Result"][0]["Verdict"])


except Exception as e:
print(e.args)

 

1 REPLY 1

Hello Ashish,

the Test Session in Integrity is just a plain Item, like any other Item in Integrity.

if you want to create, open and close a test session you will create an item, add test Cases and then set the status to "in testing", record results and finally set the status to "completed". 

Hope this helps a bit

Volker

Top Tags