I'm developing one test bench which runs multiple tests via python gui and prints the output as below.
A Passed
B Passed
C Passed
D Passed
E Passed
Button from gui should be changed to 'Passed' only when A,B,C,D,E all are Passed. If any of these tests fails, it should say failed. What is the way to access this output from gui which is printed on screen.
My code for tests is:
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import sys, os, time
from PyQt4 import QtGui, QtCore
from progress.bar import Bar
import datetime
import thread
class MyTestBench(QDialog, QtGui.QWidget):
def __init__(self):
super(QDialog, self).__init__()
self.setWindowTitle("Implementation")
self.progressbar = QtGui.QProgressBar()
self.progressbar.setMinimum(0)
self.progressbar.setMaximum(100)
self.run_test_button = QtGui.QPushButton('Run Your Tests')
self.run_test_button.clicked.connect(self.run_test_event)
def run_test_event(self):
thread.start_new_thread(self.run_the_test, ("Thread-1", 0.5))
thread.start_new_thread(self.run_the_progress, ("Thread-2", 0.5))
def run_the_test(self, tname, delay):
os.system("python nxptest.py my_testlist.txt")
self.progressbar.setValue(100)
if self.progressbar.value() == self.progressbar.maximum():
time.sleep(3)
self.run_test_button.setText('Run Your Tests')
def run_the_progress(self, tname, delay):
count = 0
while count < 5:
self.run_test_button.setText('Running.')
time.sleep(0.5)
self.run_test_button.setText('Running..')
time.sleep(0.5)
self.run_test_button.setText('Running...')
value = self.progressbar.value() + 10
self.progressbar.setValue(value)
time.sleep(0.5)
if self.progressbar.value() == self.progressbar.maximum():
self.progressbar.reset()
count = count + 1
app = QApplication(sys.argv)
dialog = MyTestBench()
dialog.setGeometry(100, 100, 200, 50)
dialog.show()
app.exec_()
The main challenge I'm facing here is I'm new to gui programming and I don't know how to access the output that is printed on screen.