Changeset 105 for trunk/MFCtooling
- Timestamp:
- 07/05/11 13:04:29 (13 years ago)
- Location:
- trunk/MFCtooling/replay
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MFCtooling/replay/LogParser.cpp
r104 r105 6 6 #include "WindowFinder.h" 7 7 8 LogParser::LogParser(_TCHAR* runCommand, unsigned int startupTime, bool useDefaultDelay) : runCommand(runCommand), startupTime(startupTime), useDefaultDelay(useDefaultDelay)8 LogParser::LogParser(_TCHAR* runCommand, unsigned int startupTime, TestResults * results, bool useDefaultDelay) : runCommand(runCommand), startupTime(startupTime), results(results), useDefaultDelay(useDefaultDelay) 9 9 { 10 10 … … 28 28 std::wstring localName(pwchLocalName); 29 29 if( localName.compare(L"session")==0 ) { 30 s td::wstring sessionId = GetAttributeValue(pAttributes, L"id", L"");30 sessionId = GetAttributeValue(pAttributes, L"id", L""); 31 31 std::wcout << L"================================================" << std::endl; 32 32 std::wcout << L"starting session " << sessionId << std::endl; 33 result.sessionPass = true; 34 result.errorMessage = L""; 35 result.msgNumber = 0; 36 currentMessage = 0; 33 37 std::wcout << L"executing " << runCommand << std::endl; 34 38 PROCESS_INFORMATION pi; … … 90 94 if( localName.compare(L"session")==0 ) { 91 95 std::wcout << L"session completed" << std::endl; 96 results->addResult(sessionId, result); 92 97 BOOL retVal = TerminateProcess(hProcess, 0); 93 98 if( retVal!=0 ) { … … 97 102 } 98 103 else if( localName.compare(L"msg")==0 ) { 104 currentMessage++; 99 105 WindowFinder finder; 100 106 HWND hwnd = finder.find(currentWindow); 107 // check if window was found, if not test has failed 108 if( result.sessionPass ) { 109 result.sessionPass = false; 110 result.errorMessage = finder.getErrorMessage(); 111 result.msgNumber = currentMessage; 112 } 113 101 114 sendMessage(hwnd); 102 115 deleteWindowData(currentWindow); -
trunk/MFCtooling/replay/LogParser.h
r104 r105 5 5 6 6 #include "WindowData.h" 7 #include "TestResults.h" 7 8 8 9 class LogParser : public SAXContentHandlerImpl … … 26 27 HANDLE hProcess; 27 28 29 std::wstring sessionId; 30 RESULT result; 31 unsigned int currentMessage; 32 33 TestResults * results; 34 28 35 public: 29 LogParser(_TCHAR * runCommand, unsigned int startupChar, bool useDefaultDelay = false);36 LogParser(_TCHAR * runCommand, unsigned int startupChar, TestResults * results, bool useDefaultDelay = false); 30 37 ~LogParser(void); 31 38 -
trunk/MFCtooling/replay/WindowFinder.cpp
r32 r105 27 27 evalPopup = false; 28 28 parentHandles = NULL; 29 success = true; 29 30 } 30 31 … … 65 66 if( maxScore==0 ) { 66 67 std::wcerr << L"Warning: Score is zero." << std::endl; 68 errorMessage = L"score zero"; 69 success = false; 67 70 } 68 71 result = find(winData->child); … … 70 73 if( parentHandles->size()==0 ) { 71 74 std::wcerr << L"Error: handle not found." << std::endl; 75 errorMessage = L"handle not found"; 72 76 result = NULL; 77 success = false; 73 78 } 74 79 else { 75 80 if( parentHandles->size()!=1 ) { 76 81 std::wcerr << L"Warning: more than one fitting window found." << std::endl; 82 errorMessage = L"multiple matches"; 83 success = false; 77 84 } 78 85 if( maxScore==0 ) { 79 86 std::wcerr << L"Warning: Score is zero." << std::endl; 87 errorMessage = L"score zero"; 88 success = false; 80 89 } 81 90 result = (*parentHandles)[0]; … … 125 134 return evalPopup; 126 135 } 136 137 bool WindowFinder::successfull() { 138 return success; 139 } 140 141 std::wstring WindowFinder::getErrorMessage() { 142 return errorMessage; 143 } -
trunk/MFCtooling/replay/WindowFinder.h
r32 r105 20 20 bool evalPopup; 21 21 22 bool success; 23 24 std::wstring errorMessage; 25 22 26 public: 23 27 WindowFinder(void); … … 30 34 bool isCurrentPopup(); 31 35 36 bool successfull(); 37 38 std::wstring getErrorMessage(); 39 32 40 }; -
trunk/MFCtooling/replay/replay.cpp
r104 r105 12 12 if (argc<3) 13 13 { 14 std::wcout << "Usage: " << argv[0] << "<replayfile> <applicationundertest> " << std::endl;14 std::wcout << "Usage: " << argv[0] << "<replayfile> <applicationundertest> [<resultfile>]" << std::endl; 15 15 return 0; 16 16 } 17 18 // execute application to be replayed19 /*if (argc>2) {20 std::wcout << "executing " << argv[2] << std::endl;21 PROCESS_INFORMATION pi;22 STARTUPINFO si;23 ZeroMemory(&pi, sizeof(pi));24 ZeroMemory(&si, sizeof(si));25 CreateProcess(NULL, argv[2], NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);26 Sleep(10000);27 }*/28 29 17 30 18 // initialize COM library for the current thread … … 41 29 42 30 if( !FAILED(hr) ) { 31 TestResults results(argv[1]); 43 32 std::wcout << L"replaying sessions in " << argv[1] << std::endl; 44 LogParser * parser = new LogParser(argv[2], 5000, true);33 LogParser * parser = new LogParser(argv[2], 5000, &results, true); 45 34 pXMLReader->putContentHandler(parser); 46 35 hr = pXMLReader->parseURL(argv[1]); … … 48 37 std::wcout << L"================================================" << std::endl; 49 38 std::wcout << L"replay completed" << std::endl; 39 if( argc>=4 ) { 40 results.write(argv[3]); 41 std::wcout << L"results written to " << argv[3] << std::endl; 42 } 50 43 } 51 44 -
trunk/MFCtooling/replay/replay.vcproj
r32 r105 2 2 <VisualStudioProject 3 3 ProjectType="Visual C++" 4 Version="9 .00"4 Version="9,00" 5 5 Name="replay" 6 6 ProjectGUID="{6CDC762E-2D22-4B0F-B6CD-7F8AB432ED42}" … … 202 202 </File> 203 203 <File 204 RelativePath=".\TestResults.cpp" 205 > 206 </File> 207 <File 204 208 RelativePath=".\WindowData.cpp" 205 209 > … … 232 236 </File> 233 237 <File 238 RelativePath=".\TestResults.h" 239 > 240 </File> 241 <File 234 242 RelativePath=".\WindowData.h" 235 243 >
Note: See TracChangeset
for help on using the changeset viewer.