2011-08-01 17:09:08 +00:00
|
|
|
#ifndef JHW_RUNNER
|
|
|
|
#define JHW_RUNNER
|
|
|
|
|
|
|
|
#include <QtGui>
|
|
|
|
#include <QtWebKit>
|
|
|
|
#include <QFile>
|
|
|
|
#include <QTextStream>
|
|
|
|
#include <iostream>
|
|
|
|
#include <QQueue>
|
|
|
|
|
|
|
|
#include "Page.h"
|
2011-08-03 16:26:39 +00:00
|
|
|
#include "ConsoleOutput.h"
|
2011-08-01 17:09:08 +00:00
|
|
|
|
|
|
|
namespace HeadlessSpecRunner {
|
|
|
|
class Runner: public QObject {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
Runner();
|
|
|
|
void setColors(bool colors);
|
|
|
|
void reportFile(const QString &file);
|
|
|
|
void addFile(const QString &spec);
|
|
|
|
void go();
|
|
|
|
public slots:
|
|
|
|
void log(const QString &msg);
|
|
|
|
void leavePageAttempt(const QString &msg);
|
|
|
|
void specPassed();
|
|
|
|
void specFailed(const QString &specDetail);
|
|
|
|
void printName(const QString &name);
|
|
|
|
void printResult(const QString &result);
|
|
|
|
void finishSuite(const QString &duration, const QString &total, const QString& failed);
|
|
|
|
private slots:
|
|
|
|
void watch(bool ok);
|
|
|
|
void errorLog(const QString &msg, int lineNumber, const QString &sourceID);
|
|
|
|
void internalLog(const QString ¬e, const QString &msg);
|
|
|
|
void addJHW();
|
|
|
|
protected:
|
|
|
|
bool hasElement(const char *select);
|
|
|
|
void timerEvent(QTimerEvent *event);
|
|
|
|
private:
|
|
|
|
HeadlessSpecRunner::Page m_page;
|
|
|
|
QBasicTimer m_ticker;
|
|
|
|
int m_runs;
|
|
|
|
bool hasErrors;
|
|
|
|
bool usedConsole;
|
|
|
|
bool showColors;
|
|
|
|
bool isFinished;
|
|
|
|
bool didFail;
|
|
|
|
bool consoleNotUsedThisRun;
|
|
|
|
QQueue<QString> runnerFiles;
|
|
|
|
QString reportFilename;
|
|
|
|
QStack<QString> failedSpecs;
|
|
|
|
|
2011-08-03 16:26:39 +00:00
|
|
|
HeadlessSpecRunner::ConsoleOutput consoleOutput;
|
|
|
|
|
2011-08-01 17:09:08 +00:00
|
|
|
void red();
|
|
|
|
void green();
|
|
|
|
void yellow();
|
|
|
|
void clear();
|
|
|
|
void loadSpec();
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|