On Tue, Jan 28, 2014 at 6:45 AM, Tony Rietwyk <t...@rightsoft.com.au> wrote:
>
> Hi Soroush,
>
>
>
> I hit the same problem, and used this:
>
>
>
> // Can't use QTEST_MAIN, since we have our own parameters as well.
>
> // QTEST_MAIN( TTestPitchXml )
>
>
>
> int main(int argc, char *argv[])
>
> {
>
> #ifdef QT_GUI_LIB
>
>     QApplication app(argc, argv);
>
>     QTEST_DISABLE_KEYPAD_NAVIGATION
>
> #else
>
>     QCoreApplication app(argc, argv);
>
> #endif
>
>     TTestPitchXml tc;
>
>     QStringList args( app.arguments() );
>
>     tc.checkArgs( args );
>
>     return QTest::qExec(&tc, args);
>
> }
>
>
>
> Hope that helps,
>
>
>
> Tony

Hi Tony

I've implemented something similar to your answer. In my test class
parseArgs removes invalid arguments from list and then passes remaining
args (who will be parsed by QTest)  to qExec. (Is this similar to what
checkArgs do?) In my test, users can invoke test suite like this:

test_program [options] [testfunctions[:testdata]] --disable-odbc
--enable-mysql --database TestDB --username DBUser --password DBPassword

where "[options] [testfunctions[:testdata]]" are those described here[1]

Cheers

[1]:
http://qt-project.org/doc/qt-4.8/qtestlib-manual.html#qtestlib-command-line-arguments
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to