2011-08-01 17:09:08 +00:00
|
|
|
#ifndef JHW_RUNNER
|
|
|
|
#define JHW_RUNNER
|
|
|
|
|
|
|
|
#include <QtGui>
|
|
|
|
#include <QtWebKit>
|
|
|
|
#include <QFile>
|
|
|
|
#include <QTextStream>
|
|
|
|
#include <iostream>
|
2011-09-02 19:52:19 +00:00
|
|
|
#include <fstream>
|
2011-08-01 17:09:08 +00:00
|
|
|
#include <QQueue>
|
|
|
|
|
|
|
|
#include "Page.h"
|
2011-08-03 16:26:39 +00:00
|
|
|
#include "ConsoleOutput.h"
|
2011-08-30 19:59:09 +00:00
|
|
|
#include "ReportFileOutput.h"
|
2011-08-01 17:09:08 +00:00
|
|
|
|
2011-09-02 19:52:19 +00:00
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
class Runner: public QObject {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2011-09-06 15:37:29 +00:00
|
|
|
enum { TIMER_TICK = 200, MAX_LOOPS = 25 };
|
|
|
|
|
2011-09-02 19:52:19 +00:00
|
|
|
Runner();
|
|
|
|
void setColors(bool colors);
|
|
|
|
void reportFile(const QString &file);
|
|
|
|
void addFile(const QString &spec);
|
|
|
|
void go();
|
2011-10-25 15:25:02 +00:00
|
|
|
public slots:
|
2011-09-02 19:52:19 +00:00
|
|
|
void leavePageAttempt(const QString &msg);
|
2011-09-06 15:37:29 +00:00
|
|
|
void timerPause();
|
|
|
|
void timerDone();
|
2011-10-24 20:40:08 +00:00
|
|
|
|
|
|
|
void print(const QString &fh, const QString &content);
|
|
|
|
|
|
|
|
void finishSuite();
|
2011-10-25 15:25:02 +00:00
|
|
|
private slots:
|
|
|
|
void watch(bool ok);
|
2011-09-02 19:52:19 +00:00
|
|
|
void errorLog(const QString &msg, int lineNumber, const QString &sourceID);
|
|
|
|
void internalLog(const QString ¬e, const QString &msg);
|
|
|
|
void addJHW();
|
2011-09-06 15:37:29 +00:00
|
|
|
void timerEvent();
|
2011-09-02 19:52:19 +00:00
|
|
|
protected:
|
|
|
|
bool hasElement(const char *select);
|
|
|
|
private:
|
|
|
|
Page m_page;
|
2011-09-06 15:37:29 +00:00
|
|
|
QTimer m_ticker;
|
2011-09-02 19:52:19 +00:00
|
|
|
int m_runs;
|
|
|
|
bool hasErrors;
|
|
|
|
bool usedConsole;
|
|
|
|
bool isFinished;
|
|
|
|
bool didFail;
|
|
|
|
QQueue<QString> runnerFiles;
|
|
|
|
QStack<QString> failedSpecs;
|
|
|
|
|
|
|
|
QString reportFileName;
|
|
|
|
|
|
|
|
void loadSpec();
|
2011-10-24 20:40:08 +00:00
|
|
|
|
|
|
|
QFile *outputFile;
|
|
|
|
QTextStream *ts;
|
2011-09-02 19:52:19 +00:00
|
|
|
};
|
2011-08-01 17:09:08 +00:00
|
|
|
|
|
|
|
#endif
|