source: trunk/MFCtooling/replay/TestResults.cpp @ 1752

Last change on this file since 1752 was 105, checked in by sherbold, 13 years ago

+ added test verdict pass/fail, including error message and the number of the message in the session at which the verdict was set
+ added result file; location is a parameter when calling the application
+ added test arbiter: if the target of a message cannot be determined correctly, the session fails

File size: 1.1 KB
RevLine 
[105]1#include "StdAfx.h"
2#include "TestResults.h"
3
4TestResults::TestResults(_TCHAR * replayFile) : replayFile(replayFile)
5{
6}
7
8TestResults::~TestResults(void)
9{
10}
11
12
13void TestResults::addResult(std::wstring sessionId, RESULT result)
14{
15        results.push_back(std::pair<std::wstring, RESULT>(sessionId, result));
16}
17
18
19void TestResults::write(_TCHAR * resultFile) {
20        std::wofstream file(resultFile, std::ios_base::trunc);
21
22        file << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl; // TODO check encoding
23        file << "<results file=\"" << replayFile << "\">" << std::endl;
24        for( size_t i=0; i<results.size() ; i++ ) {
25                RESULT & result = results[i].second;
26                file << "  <session id=\"" << results[i].first << "\" verdict=\"";
27                if( result.sessionPass==true ) {
28                        file << "pass\"/>" << std::endl;
29                } else {
30                        file << "fail\">"; // TODO
31                        file << "    <details msgNo=\"" << result.msgNumber << "\" errMsg=\"" << result.errorMessage << "\"/>" << std::endl;
32                        file << "  </session>" << std::endl;
33                }
34        }
35        file << "</results>" << std::endl;
36        file.flush();
37        file.close();
38}
Note: See TracBrowser for help on using the repository browser.