13 * |
13 * |
14 * Description: |
14 * Description: |
15 * |
15 * |
16 */ |
16 */ |
17 #include "ut_logsmainwindow.h" |
17 #include "ut_logsmainwindow.h" |
|
18 #include "ut_logsapplication.h" |
18 #include "ut_logscomponentrepository.h" |
19 #include "ut_logscomponentrepository.h" |
19 #include "ut_logsviewmanager.h" |
20 #include "ut_logsviewmanager.h" |
20 #include "ut_logsbaseview.h" |
21 #include "ut_logsbaseview.h" |
21 #include "ut_logsrecentcallsview.h" |
22 #include "ut_logsrecentcallsview.h" |
22 #include "ut_logsdetailsview.h" |
23 #include "ut_logsdetailsview.h" |
23 #include "ut_logsmatchesview.h" |
24 #include "ut_logsmatchesview.h" |
24 #include "ut_logseffecthandler.h" |
25 #include "ut_logseffecthandler.h" |
25 #include "ut_logsservicehandler.h" |
26 #include "ut_logsservicehandler.h" |
26 #include "ut_logspageindicator.h" |
27 #include "ut_logspageindicator.h" |
27 #include "ut_logspageindicatoritem.h" |
28 #include "ut_logspageindicatoritem.h" |
28 #include "testresultxmlparser.h" |
29 #include "testrunner.h" |
29 |
30 |
30 #include <QtTest/QtTest> |
31 #include <QtTest/QtTest> |
31 |
32 |
32 |
|
33 #define UT_ARGS( args, file )\ |
|
34 QStringList args( "ut_logsapp");\ |
|
35 args << "-silent" << "-xml" << "-o" << file |
|
36 |
|
37 |
|
38 int main(int argc, char *argv[]) |
33 int main(int argc, char *argv[]) |
39 { |
34 { |
40 bool promptOnExit(true); |
|
41 for (int i=0; i<argc; i++) { |
|
42 if (QString(argv[i]) == "-noprompt") |
|
43 promptOnExit = false; |
|
44 } |
|
45 printf("Running tests...\n"); |
35 printf("Running tests...\n"); |
46 |
36 |
47 QApplication app(argc, argv); |
37 QApplication app(argc, argv); |
48 TestResultXmlParser parser; |
38 QStringList args = app.arguments(); |
|
39 QString combinedOutputFileName; |
|
40 for ( int i = 0; i < args.count(); i++ ){ |
|
41 QString arg = args.at(i); |
|
42 if ( arg == QString("-o") && i + 1 < args.count() ){ |
|
43 i++; |
|
44 combinedOutputFileName = args.at(i); |
|
45 } |
|
46 } |
|
47 |
|
48 TestRunner testRunner("LogsApp", combinedOutputFileName); |
49 |
49 |
50 UT_LogsMainWindow ut_logsMainWindow; |
50 UT_LogsMainWindow ut_logsMainWindow; |
51 QString resultFileNameForMainWindow = "c:/ut_logsMainWindow.xml"; |
51 testRunner.runTests(ut_logsMainWindow); |
52 UT_ARGS( args_logsMainWindow, resultFileNameForMainWindow ); |
|
53 QTest::qExec( &ut_logsMainWindow, args_logsMainWindow ); |
|
54 parser.parseAndPrintResults(resultFileNameForMainWindow); |
|
55 |
52 |
56 UT_LogsComponentRepository ut_logsRepository; |
53 UT_LogsComponentRepository ut_logsRepository; |
57 QString resultFileNameForComponentRepository = "c:/ut_logsRepository.xml"; |
54 testRunner.runTests(ut_logsRepository); |
58 UT_ARGS( args_logsRepository, resultFileNameForComponentRepository ); |
|
59 QTest::qExec( &ut_logsRepository, args_logsRepository ); |
|
60 parser.parseAndPrintResults(resultFileNameForComponentRepository); |
|
61 |
55 |
62 UT_LogsViewManager ut_logsViewManager; |
56 UT_LogsViewManager ut_logsViewManager; |
63 QString resultFileNameForViewManager = "c:/ut_logsViewManager.xml"; |
57 testRunner.runTests(ut_logsViewManager); |
64 UT_ARGS( args_logsViewManager, resultFileNameForViewManager ); |
58 |
65 QTest::qExec( &ut_logsViewManager, args_logsViewManager ); |
|
66 parser.parseAndPrintResults(resultFileNameForViewManager); |
|
67 |
|
68 UT_LogsBaseView ut_logsBaseView; |
59 UT_LogsBaseView ut_logsBaseView; |
69 QString resultFileNameForBaseView = "c:/ut_logsBaseView.xml"; |
60 testRunner.runTests(ut_logsBaseView); |
70 UT_ARGS( args_logsBaseView, resultFileNameForBaseView ); |
|
71 QTest::qExec( &ut_logsBaseView, args_logsBaseView ); |
|
72 parser.parseAndPrintResults(resultFileNameForBaseView); |
|
73 |
61 |
74 UT_LogsRecentCallsView ut_logsRecentCallsView; |
62 UT_LogsRecentCallsView ut_logsRecentCallsView; |
75 QString resultFileNameForRecentCallsView = "c:/ut_logsRecentCallsView.xml"; |
63 testRunner.runTests(ut_logsRecentCallsView); |
76 UT_ARGS( args_logsRecentCallsView, resultFileNameForRecentCallsView ); |
|
77 QTest::qExec( &ut_logsRecentCallsView, args_logsRecentCallsView ); |
|
78 parser.parseAndPrintResults(resultFileNameForRecentCallsView); |
|
79 |
64 |
80 UT_LogsDetailsView ut_logsDetailsView; |
65 UT_LogsDetailsView ut_logsDetailsView; |
81 QString resultFileNameForDetailsView = "c:/ut_logsDetailsView.xml"; |
66 testRunner.runTests(ut_logsDetailsView); |
82 UT_ARGS( args_logsDetailsView, resultFileNameForDetailsView ); |
|
83 QTest::qExec( &ut_logsDetailsView, args_logsDetailsView ); |
|
84 parser.parseAndPrintResults(resultFileNameForDetailsView); |
|
85 |
67 |
86 UT_LogsMatchesView ut_logsMatchesView; |
68 UT_LogsMatchesView ut_logsMatchesView; |
87 QString resultFileNameForMatchesView = "c:/ut_logsMatchesView.xml"; |
69 testRunner.runTests(ut_logsMatchesView); |
88 UT_ARGS( args_logsMatchesView, resultFileNameForMatchesView ); |
70 |
89 QTest::qExec( &ut_logsMatchesView, args_logsMatchesView ); |
|
90 parser.parseAndPrintResults(resultFileNameForMatchesView); |
|
91 |
|
92 UT_LogsEffectHandler ut_logsEffectHandler; |
71 UT_LogsEffectHandler ut_logsEffectHandler; |
93 QString resultFileNameForEffectHandler = "c:/ut_logsEffectHandler.xml"; |
72 testRunner.runTests(ut_logsEffectHandler); |
94 UT_ARGS( args_logsEffectHandler, resultFileNameForEffectHandler ); |
73 |
95 QTest::qExec( &ut_logsEffectHandler, args_logsEffectHandler ); |
|
96 parser.parseAndPrintResults(resultFileNameForEffectHandler); |
|
97 |
|
98 UT_LogsServiceHandler ut_logsServiceHandler; |
74 UT_LogsServiceHandler ut_logsServiceHandler; |
99 QString resultFileNameForServiceHandler = "c:/ut_logsServiceHandler.xml"; |
75 testRunner.runTests(ut_logsServiceHandler); |
100 UT_ARGS( args_logsServiceHandler, resultFileNameForServiceHandler ); |
|
101 QTest::qExec( &ut_logsServiceHandler, args_logsServiceHandler ); |
|
102 parser.parseAndPrintResults(resultFileNameForServiceHandler); |
|
103 |
76 |
104 UT_LogsPageIndicator ut_logsPageIndicator; |
77 UT_LogsPageIndicator ut_logsPageIndicator; |
105 QString resultFileNameForPageIndicator = "c:/ut_logsPageIndicator.xml"; |
78 testRunner.runTests(ut_logsPageIndicator); |
106 UT_ARGS( args_logsPageIndicator, resultFileNameForPageIndicator ); |
79 |
107 QTest::qExec( &ut_logsPageIndicator, args_logsPageIndicator ); |
|
108 parser.parseAndPrintResults(resultFileNameForPageIndicator); |
|
109 |
|
110 UT_LogsPageIndicatorItem ut_logsPageIndicatorItem; |
80 UT_LogsPageIndicatorItem ut_logsPageIndicatorItem; |
111 QString resultFileNameForPageIndicatorItem = "c:/ut_logsPageIndicatorItem.xml"; |
81 testRunner.runTests(ut_logsPageIndicatorItem); |
112 UT_ARGS( args_logsPageIndicatorItem, resultFileNameForPageIndicatorItem ); |
82 |
113 QTest::qExec( &ut_logsPageIndicatorItem, args_logsPageIndicatorItem ); |
83 //qApp is deleted after this testcase is run |
114 parser.parseAndPrintResults(resultFileNameForPageIndicatorItem); |
84 //keep this testcase last |
115 |
85 UT_LogsApplication ut_logsApplication; |
116 if (promptOnExit) { |
86 testRunner.runTests(ut_logsApplication); |
117 printf("Press any key...\n"); |
87 |
118 //getchar(); |
88 testRunner.printResults(); |
119 } |
89 |
120 return 0; |
90 return 0; |
121 } |
91 } |
122 |
92 |