Index: /trunk/MFCtooling/replay/LogParser.cpp
===================================================================
--- /trunk/MFCtooling/replay/LogParser.cpp	(revision 104)
+++ /trunk/MFCtooling/replay/LogParser.cpp	(revision 105)
@@ -6,5 +6,5 @@
 #include "WindowFinder.h"
 
-LogParser::LogParser(_TCHAR* runCommand, unsigned int startupTime, bool useDefaultDelay) : runCommand(runCommand), startupTime(startupTime), useDefaultDelay(useDefaultDelay)
+LogParser::LogParser(_TCHAR* runCommand, unsigned int startupTime, TestResults * results, bool useDefaultDelay) : runCommand(runCommand), startupTime(startupTime), results(results), useDefaultDelay(useDefaultDelay)
 {
 	
@@ -28,7 +28,11 @@
 	std::wstring localName(pwchLocalName);
 	if( localName.compare(L"session")==0 ) {
-		std::wstring sessionId = GetAttributeValue(pAttributes, L"id", L"");
+		sessionId = GetAttributeValue(pAttributes, L"id", L"");
 		std::wcout << L"================================================" << std::endl;
 		std::wcout << L"starting session " << sessionId << std::endl;
+		result.sessionPass = true;
+		result.errorMessage = L"";
+		result.msgNumber = 0;
+		currentMessage = 0;
 		std::wcout << L"executing " << runCommand << std::endl;
 		PROCESS_INFORMATION pi;
@@ -90,4 +94,5 @@
 	if( localName.compare(L"session")==0 ) {
 		std::wcout << L"session completed" << std::endl;
+		results->addResult(sessionId, result);
 		BOOL retVal = TerminateProcess(hProcess, 0);
 		if( retVal!=0 ) {
@@ -97,6 +102,14 @@
 	} 
 	else if( localName.compare(L"msg")==0 ) {
+		currentMessage++;
 		WindowFinder finder;
 		HWND hwnd = finder.find(currentWindow);
+		// check if window was found, if not test has failed
+		if( result.sessionPass ) {
+			result.sessionPass = false;
+			result.errorMessage = finder.getErrorMessage();
+			result.msgNumber = currentMessage;
+		}
+
 		sendMessage(hwnd);
 		deleteWindowData(currentWindow);
Index: /trunk/MFCtooling/replay/LogParser.h
===================================================================
--- /trunk/MFCtooling/replay/LogParser.h	(revision 104)
+++ /trunk/MFCtooling/replay/LogParser.h	(revision 105)
@@ -5,4 +5,5 @@
 
 #include "WindowData.h"
+#include "TestResults.h"
 
 class LogParser : public SAXContentHandlerImpl
@@ -26,6 +27,12 @@
 	HANDLE hProcess;
 
+	std::wstring sessionId;
+	RESULT result;
+	unsigned int currentMessage;
+
+	TestResults * results;
+
 public:
-	LogParser(_TCHAR * runCommand, unsigned int startupChar, bool useDefaultDelay = false);
+	LogParser(_TCHAR * runCommand, unsigned int startupChar, TestResults * results, bool useDefaultDelay = false);
 	~LogParser(void);
 
Index: /trunk/MFCtooling/replay/TestResults.cpp
===================================================================
--- /trunk/MFCtooling/replay/TestResults.cpp	(revision 105)
+++ /trunk/MFCtooling/replay/TestResults.cpp	(revision 105)
@@ -0,0 +1,38 @@
+#include "StdAfx.h"
+#include "TestResults.h"
+
+TestResults::TestResults(_TCHAR * replayFile) : replayFile(replayFile)
+{
+}
+
+TestResults::~TestResults(void)
+{
+}
+
+
+void TestResults::addResult(std::wstring sessionId, RESULT result)
+{
+	results.push_back(std::pair<std::wstring, RESULT>(sessionId, result));
+}
+
+
+void TestResults::write(_TCHAR * resultFile) {
+	std::wofstream file(resultFile, std::ios_base::trunc);
+
+	file << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl; // TODO check encoding
+	file << "<results file=\"" << replayFile << "\">" << std::endl;
+	for( size_t i=0; i<results.size() ; i++ ) {
+		RESULT & result = results[i].second;
+		file << "  <session id=\"" << results[i].first << "\" verdict=\"";
+		if( result.sessionPass==true ) {
+			file << "pass\"/>" << std::endl;
+		} else {
+			file << "fail\">"; // TODO
+			file << "    <details msgNo=\"" << result.msgNumber << "\" errMsg=\"" << result.errorMessage << "\"/>" << std::endl;
+			file << "  </session>" << std::endl;
+		}
+	}
+	file << "</results>" << std::endl;
+	file.flush();
+	file.close();
+}
Index: /trunk/MFCtooling/replay/TestResults.h
===================================================================
--- /trunk/MFCtooling/replay/TestResults.h	(revision 105)
+++ /trunk/MFCtooling/replay/TestResults.h	(revision 105)
@@ -0,0 +1,24 @@
+#pragma once
+
+#include <string>
+#include <vector>
+#include <fstream>
+
+typedef struct _RESULT {
+	bool sessionPass;
+	std::wstring errorMessage;
+	int msgNumber;
+} RESULT;
+
+class TestResults
+{
+private:
+	std::vector<std::pair<std::wstring, RESULT>> results;	
+	_TCHAR * replayFile;
+public:
+	TestResults(_TCHAR * replayFile);
+	~TestResults(void);
+
+	void addResult(std::wstring sessionId, RESULT result);
+	void write(_TCHAR * resultFile);
+};
Index: /trunk/MFCtooling/replay/WindowFinder.cpp
===================================================================
--- /trunk/MFCtooling/replay/WindowFinder.cpp	(revision 104)
+++ /trunk/MFCtooling/replay/WindowFinder.cpp	(revision 105)
@@ -27,4 +27,5 @@
 	evalPopup = false;
 	parentHandles = NULL;
+	success = true;
 }
 
@@ -65,4 +66,6 @@
 		if( maxScore==0 ) {
 			std::wcerr << L"Warning: Score is zero." << std::endl;
+			errorMessage = L"score zero";
+			success = false;
 		}
 		result = find(winData->child);
@@ -70,12 +73,18 @@
 		if( parentHandles->size()==0 ) {
 			std::wcerr << L"Error: handle not found." << std::endl;
+			errorMessage = L"handle not found";
 			result = NULL;
+			success = false;
 		}
 		else {
 			if( parentHandles->size()!=1 ) {
 				std::wcerr << L"Warning: more than one fitting window found." << std::endl;
+				errorMessage = L"multiple matches";
+				success = false;
 			}
 			if( maxScore==0 ) {
 				std::wcerr << L"Warning: Score is zero." << std::endl;
+				errorMessage = L"score zero";
+				success = false;
 			}
 			result = (*parentHandles)[0];
@@ -125,2 +134,10 @@
 	return evalPopup;
 }
+
+bool WindowFinder::successfull() {
+	return success;
+}
+
+std::wstring WindowFinder::getErrorMessage() {
+	return errorMessage;
+}
Index: /trunk/MFCtooling/replay/WindowFinder.h
===================================================================
--- /trunk/MFCtooling/replay/WindowFinder.h	(revision 104)
+++ /trunk/MFCtooling/replay/WindowFinder.h	(revision 105)
@@ -20,4 +20,8 @@
 	bool evalPopup;
 
+	bool success;
+
+	std::wstring errorMessage;
+
 public:
 	WindowFinder(void);
@@ -30,3 +34,7 @@
 	bool isCurrentPopup();
 
+	bool successfull();
+
+	std::wstring getErrorMessage();
+
 };
Index: /trunk/MFCtooling/replay/replay.cpp
===================================================================
--- /trunk/MFCtooling/replay/replay.cpp	(revision 104)
+++ /trunk/MFCtooling/replay/replay.cpp	(revision 105)
@@ -12,19 +12,7 @@
 	if (argc<3) 
 	{
-		std::wcout << "Usage: " << argv[0] << "<replayfile> <applicationundertest>" << std::endl;
+		std::wcout << "Usage: " << argv[0] << "<replayfile> <applicationundertest> [<resultfile>]" << std::endl;
 		return 0;
 	}
-
-	// execute application to be replayed
-	/*if (argc>2) {
-		std::wcout << "executing " << argv[2] << std::endl;
-		PROCESS_INFORMATION pi;
-		STARTUPINFO si;
-		ZeroMemory(&pi, sizeof(pi));
-		ZeroMemory(&si, sizeof(si));
-		CreateProcess(NULL, argv[2], NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
-		Sleep(10000);
-	}*/
-
 
 	// initialize COM library for the current thread
@@ -41,6 +29,7 @@
 
 	if( !FAILED(hr) ) {
+		TestResults results(argv[1]);
 		std::wcout << L"replaying sessions in " << argv[1] << std::endl;
-		LogParser * parser = new LogParser(argv[2], 5000, true);
+		LogParser * parser = new LogParser(argv[2], 5000, &results, true);
 		pXMLReader->putContentHandler(parser);
 		hr = pXMLReader->parseURL(argv[1]);
@@ -48,4 +37,8 @@
 		std::wcout << L"================================================" << std::endl;
 		std::wcout << L"replay completed" << std::endl;
+		if( argc>=4 ) {
+			results.write(argv[3]);
+			std::wcout << L"results written to " << argv[3] << std::endl;
+		}
 	}
 
Index: /trunk/MFCtooling/replay/replay.vcproj
===================================================================
--- /trunk/MFCtooling/replay/replay.vcproj	(revision 104)
+++ /trunk/MFCtooling/replay/replay.vcproj	(revision 105)
@@ -2,5 +2,5 @@
 <VisualStudioProject
 	ProjectType="Visual C++"
-	Version="9.00"
+	Version="9,00"
 	Name="replay"
 	ProjectGUID="{6CDC762E-2D22-4B0F-B6CD-7F8AB432ED42}"
@@ -202,4 +202,8 @@
 			</File>
 			<File
+				RelativePath=".\TestResults.cpp"
+				>
+			</File>
+			<File
 				RelativePath=".\WindowData.cpp"
 				>
@@ -232,4 +236,8 @@
 			</File>
 			<File
+				RelativePath=".\TestResults.h"
+				>
+			</File>
+			<File
 				RelativePath=".\WindowData.h"
 				>
