Open patrickdaj opened 4 years ago
Was this ever fixed?
Was this ever fixed? Hi Patrick, We are working on fixing this in the next 9.10 Patch build that is targeted to be released in the next couple of weeks. Thanks for bringing it to our attention.
Until then you can use this function as a workarround:
import json
def stopTest(testid, bps):
testid = "TEST-%s" % testid
service = 'https://' + bps.host + '/api/v1/bps/tests/operations/stop'
jheaders = {'content-type': 'application/json'}
jdata = json.dumps({'testid':testid})
r = bps.session.post(service, data=jdata, headers=jheaders, verify=False)
if(r.status_code == 200):
print('Test: [' + testid + '] has been successfully stopped.')
else:
print('Some error occurred while cancelling the running test: [' + testid + ']')
# example ussage
from bps_restpy.bps import BPS,pp
bps = BPS(bps_system, bpsuser, bpspass)
bps.login()
testid = 97
stopTest(testid, bps)
bps.logout()
Regards, Constantin
testmodel.stopRun method hangs when run in a different bps_restpy session than the testmodel.run. The test does stop but the python API just hangs infinitely. This is pretty useful when you are automating long running tests to split the start and stop between multiple scripts.
Successfully connected to x.x.x.x.
Login successful.
Welcome user.
Your session id is 5d180626-49ac-4cf3-b694-1b5b4b229fe2
Out[6]: {'host': '127.0.0.1', 'name': 'test', 'iteration': 30, 'runid': 96}
Out[7]: b'canceled'
Out[8]: {'host': '127.0.0.1', 'name': 'test', 'iteration': 31, 'runid': 97}
Logout successful.
Bye user.
Successfully disconnected from x.x.x.x.
Successfully connected to x.x.x.x.
Login successful.
Welcome user.
Your session id is aee3511f-dbed-4de5-a4f1-c9f7179f920d
The last stopRun call just hangs infinitely. Above when the stopRun was done in the same session it completed with a response of b’canceled’.