I want to write a testing program. It will open a special *.tests
file and test direct program with tests from the file.
I need to:
- Run some program. e.g
./main -testing 45 563 67
- Listen to result.
How I can to do it? I want to run program main
with some tests开发者_如何学运维 and listen to its result.
You should ues the QProcess
class to start your program.
QString program = "./main";
QStringList arguments;
arguments << "-testing" << "45" << "563" << ...;
QProcess *myProcess = new QProcess(parent);
myProcess->start(program, arguments);
Then you can use the waitForFinished
to wait for it to finish.
exitCode
will give you the return code.
The readAllStandardOutput
(or *Error
) methods allow you to read what the process has output to the console.
精彩评论