tsrc/qtestutils/inc/testresultxmlparser.h
branchRCL_3
changeset 33 bc78a40cd63c
parent 32 73a1feb507fb
child 35 6c57ef9392d2
equal deleted inserted replaced
32:73a1feb507fb 33:bc78a40cd63c
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef TESTRESULTXMLPARSER_H
       
    19 #define TESTRESULTXMLPARSER_H
       
    20 
       
    21 #include <QXmlDefaultHandler>
       
    22 
       
    23 
       
    24 class TestResultXmlParser : public QXmlDefaultHandler
       
    25 {
       
    26 public: // Constructors and destructor
       
    27     TestResultXmlParser();
       
    28     ~TestResultXmlParser();    
       
    29     
       
    30 public: // From QXmlContentHandler 
       
    31     bool startElement(
       
    32         const QString& namespaceURI,
       
    33         const QString& localName,
       
    34         const QString& qName,
       
    35         const QXmlAttributes& atts);
       
    36     
       
    37     bool endElement(
       
    38         const QString& namespaceURI,
       
    39         const QString& localName,
       
    40         const QString& qName);
       
    41     
       
    42     bool characters(const QString& ch);
       
    43        
       
    44 public: // New functions
       
    45     
       
    46     int parse(const QString& fileName);
       
    47     
       
    48     int parseAndPrintResults(
       
    49         const QString& fileName,
       
    50         bool printDetails=false);
       
    51     
       
    52     int testCount();
       
    53     
       
    54     QStringList errors();
       
    55     
       
    56 private: // Data
       
    57     int mTestCount;
       
    58     QStringList* mErrors;
       
    59     bool mParsingIncidentElement;
       
    60     bool mParsingDescriptionElement;
       
    61     bool mCurrentTestFailed;
       
    62     QString mCurrentTestName;
       
    63     QString mCurrentTestFile;
       
    64     int mCurrentTestFailureLine;
       
    65 };
       
    66 
       
    67 
       
    68 #endif // TESTRESULTXMLPARSER_H