logsui/logsengine/tsrc/at_logsengine/src/main.cpp
changeset 21 2f0af9ba7665
parent 0 4a5361db8937
equal deleted inserted replaced
18:acd4e87b24b4 21:2f0af9ba7665
    17 
    17 
    18 
    18 
    19 #include <QtTest/QtTest>
    19 #include <QtTest/QtTest>
    20 
    20 
    21 #include "at_logsengine.h"
    21 #include "at_logsengine.h"
    22 #include "testresultxmlparser.h"
    22 #include "testrunner.h"
    23 
    23 
    24 
    24 
    25 int main(int argc, char *argv[]) 
    25 int main(int argc, char *argv[]) 
    26 {
    26 {
    27     bool promptOnExit(true);
    27     bool noGui(false);
       
    28     bool noFullGui(false);
       
    29     QString combinedOutputFileName;
    28     for (int i=0; i<argc; i++) {
    30     for (int i=0; i<argc; i++) {
    29         if (QString(argv[i]) == "-noprompt")
    31         if (QString(argv[i]) == "-nogui"){
    30             promptOnExit = false;
    32             noGui = true;
       
    33         } else if (QString(argv[i]) == "-nofullgui"){
       
    34             noFullGui = true;
       
    35         } else if (QString(argv[i]) == "-o" && i + 1 < argc ){
       
    36             i++;
       
    37             combinedOutputFileName = QString(argv[i]);
       
    38         }
    31     }
    39     }
    32     printf("Running tests...\n");
    40     TestRunner testRunner("API_Test_LogsEngine", combinedOutputFileName);
       
    41     if ( noGui ){
       
    42         CActiveScheduler* sched = new CActiveScheduler;
       
    43         CActiveScheduler::Install(sched);
       
    44         AT_LogsEngine test;
       
    45         testRunner.runTests(test);
       
    46         CActiveScheduler::Install(0);
       
    47         delete sched;
       
    48     } else if ( noFullGui ){
       
    49         QCoreApplication app(argc, argv);
       
    50         AT_LogsEngine test;
       
    51         testRunner.runTests(test);
       
    52     } else {
       
    53         printf("Running tests...\n");
    33     
    54     
    34     QApplication app(argc, argv);
    55         QApplication app(argc, argv);
    35     TestResultXmlParser parser;
    56         AT_LogsEngine test;
    36     
    57         testRunner.runTests(test);
    37     AT_LogsEngine test;
       
    38     QString resultFileName = "c:/at_logs_logsEngine.xml";
       
    39     QStringList args_test( "at_logsEngine");
       
    40     args_test << "-xml" << "-o" << resultFileName;
       
    41     QTest::qExec(&test, args_test);
       
    42     parser.parseAndPrintResults(resultFileName,true); 
       
    43 
       
    44     if (promptOnExit) {
       
    45         printf("Press any key...\n");
       
    46         getchar(); 
       
    47     }
    58     }
       
    59     testRunner.printResults(); 
    48     return 0;   
    60     return 0;   
    49 }
    61 }
    50 
    62 
    51 
    63 
    52 
    64 
    53  
    65  
       
    66