I have a situation where i need to get Pass/Fail from tester for every test step in PySide GUI. Now the data of testsuite i am running in for loop and trying to get current checked/unchecked state of QRadioButton in for loop based on which i will do further code processing. My code is :-
for i in range(self.ui.hlfDataset_sa_lst.count()):
self.ui.pass_radio.setChecked(False)
self.ui.fail_radio.setChecked(False)
print "command ", str(self.ui.hlfDataset_sa_lst.item(i).text())
print "Run ", str(i)+" is here"
##
self.telnetThread = TelnetThread.SocketTunnel("localhost",2000)
returnCommand = self.telnetThread.communicateSock(str(self.ui.hlfDataset_sa_lst.item(i).text()))
print "returnCommand ",returnCommand
##XML Data structure
result = ET.SubElement(results,"result")
testcasestepno = ET.SubElement(result,"testcasestepno")
testerComment = ET.SubElement(result,"testerComment")
testresult = ET.SubElement(result,"testresult")
mguImage = ET.SubElement(result,"mguImage")
if self.ui.pass_radio.isChecked():
print "TC passed "
testcasestepno.text = str(i+1)
testresult.text = "PASS"
mguImage.text = "NA"
testerComment.text=str(self.ui.testercomment_txt.text())
elif self.ui.fail_radio.isChecked():
if not str(self.ui.testercomment_txt.text()):
QtGui.QMessageBox.critical(self, 'Tester Comment ', 'Tester Comment is desired ', QtGui.QMessageBox.Ok)
self.ui.pass_radio.setChecked(False)
self.ui.fail_radio.setChecked(False)
else:
print "TC failed "
testcasestepno.text = str(i+1)
testresult.text = "FAIL"
testerComment.text = str(self.ui.testercomment_txt.text())
#Save Live Image when failed
I want for loop to wait until tester has provided the input and i don't want to put sleep or in anyway to use thread unless convenient way is shown. This code runs complete loop without waiting for input.