void DumpRenderTree::runRemainingTests() { if (runFromCommandLine) { doneDrt(); return; } // FIXME: fflush should not be necessary but is temporarily required due to a bug in stdio output. fflush(stdout); fflush(stderr); if (m_currentTest >= m_tests.end() - 1) { m_tests.clear(); if (m_bufferedTests.size() > 0) { m_tests.append(m_bufferedTests); m_bufferedTests.clear(); m_currentTest = m_tests.begin(); runCurrentTest(); } return; } m_currentTest++; runCurrentTest(); }
Totals runTest( TestCase const& testCase ) { Totals prevTotals = m_totals; std::string redirectedCout; std::string redirectedCerr; TestCaseInfo testInfo = testCase.getTestCaseInfo(); m_reporter->testCaseStarting( testInfo ); m_activeTestCase = &testCase; m_testCaseTracker = TestCaseTracker( testInfo.name ); do { do { runCurrentTest( redirectedCout, redirectedCerr ); } while( !m_testCaseTracker->isCompleted() && !aborting() ); } while( getCurrentContext().advanceGeneratorsForCurrentTest() && !aborting() ); Totals deltaTotals = m_totals.delta( prevTotals ); m_totals.testCases += deltaTotals.testCases; m_reporter->testCaseEnded( TestCaseStats( testInfo, deltaTotals, redirectedCout, redirectedCerr, aborting() ) ); m_activeTestCase = NULL; m_testCaseTracker.reset(); return deltaTotals; }
void runTest( const TestCaseInfo& testInfo ) { Totals prevTotals = m_totals; std::string redirectedCout; std::string redirectedCerr; m_reporter->StartTestCase( testInfo ); m_runningTest = new RunningTest( &testInfo ); do { do { // m_reporter->StartGroup( "test case run" ); m_currentResult.setLineInfo( m_runningTest->getTestCaseInfo().getLineInfo() ); runCurrentTest( redirectedCout, redirectedCerr ); // m_reporter->EndGroup( "test case run", m_totals.delta( prevTotals ) ); } while( m_runningTest->hasUntestedSections() && !aborting() ); } while( getCurrentContext().advanceGeneratorsForCurrentTest() && !aborting() ); delete m_runningTest; m_runningTest = NULL; Totals deltaTotals = m_totals.delta( prevTotals ); m_totals.testCases += deltaTotals.testCases; m_reporter->EndTestCase( testInfo, deltaTotals, redirectedCout, redirectedCerr ); }
void runTest ( const TestCaseInfo& testInfo ) { std::size_t prevSuccessCount = m_successes; std::size_t prevFailureCount = m_failures; std::string redirectedCout; std::string redirectedCerr; m_reporter->StartTestCase( testInfo ); m_runningTest = new RunningTest( &testInfo ); do { do { m_currentResult.setFileAndLine( m_runningTest->getTestCaseInfo().getFilename(), m_runningTest->getTestCaseInfo().getLine() ); runCurrentTest( redirectedCout, redirectedCerr ); } while( m_runningTest->hasUntestedSections() ); } while( Hub::advanceGeneratorsForCurrentTest() ); delete m_runningTest; m_runningTest = NULL; m_reporter->EndTestCase( testInfo, m_successes - prevSuccessCount, m_failures - prevFailureCount, redirectedCout, redirectedCerr ); }
void DumpRenderTree::addTest(const char* testFile) { String test(testFile); if (test == "#DONE") doneDrt(); else if (!test.isEmpty()) { if (m_tests.isEmpty()) { // No test is being run, initialize iterator and start test m_tests.append(test); m_currentTest = m_tests.begin(); runCurrentTest(); } else m_bufferedTests.append(test); } }
Totals runTest( TestCase const& testCase ) { Totals prevTotals = m_totals; std::string redirectedCout; std::string redirectedCerr; TestCaseInfo testInfo = testCase.getTestCaseInfo(); m_reporter->testCaseStarting( testInfo ); m_activeTestCase = &testCase; do { ITracker& rootTracker = m_trackerContext.startRun(); assert( rootTracker.isSectionTracker() ); static_cast<SectionTracker&>( rootTracker ).addInitialFilters( m_config->getSectionsToRun() ); do { m_trackerContext.startCycle(); m_testCaseTracker = &SectionTracker::acquire( m_trackerContext, TestCaseTracking::NameAndLocation( testInfo.name, testInfo.lineInfo ) ); runCurrentTest( redirectedCout, redirectedCerr ); } while( !m_testCaseTracker->isSuccessfullyCompleted() && !aborting() ); } // !TBD: deprecated - this will be replaced by indexed trackers while( getCurrentContext().advanceGeneratorsForCurrentTest() && !aborting() ); Totals deltaTotals = m_totals.delta( prevTotals ); if( testInfo.expectedToFail() && deltaTotals.testCases.passed > 0 ) { deltaTotals.assertions.failed++; deltaTotals.testCases.passed--; deltaTotals.testCases.failed++; } m_totals.testCases += deltaTotals.testCases; m_reporter->testCaseEnded( TestCaseStats( testInfo, deltaTotals, redirectedCout, redirectedCerr, aborting() ) ); m_activeTestCase = CATCH_NULL; m_testCaseTracker = CATCH_NULL; return deltaTotals; }
Totals RunContext::runTest(TestCase const& testCase) { Totals prevTotals = m_totals; std::string redirectedCout; std::string redirectedCerr; auto const& testInfo = testCase.getTestCaseInfo(); m_reporter->testCaseStarting(testInfo); m_activeTestCase = &testCase; ITracker& rootTracker = m_trackerContext.startRun(); assert(rootTracker.isSectionTracker()); static_cast<SectionTracker&>(rootTracker).addInitialFilters(m_config->getSectionsToRun()); do { m_trackerContext.startCycle(); m_testCaseTracker = &SectionTracker::acquire(m_trackerContext, TestCaseTracking::NameAndLocation(testInfo.name, testInfo.lineInfo)); runCurrentTest(redirectedCout, redirectedCerr); } while (!m_testCaseTracker->isSuccessfullyCompleted() && !aborting()); Totals deltaTotals = m_totals.delta(prevTotals); if (testInfo.expectedToFail() && deltaTotals.testCases.passed > 0) { deltaTotals.assertions.failed++; deltaTotals.testCases.passed--; deltaTotals.testCases.failed++; } m_totals.testCases += deltaTotals.testCases; m_reporter->testCaseEnded(TestCaseStats(testInfo, deltaTotals, redirectedCout, redirectedCerr, aborting())); m_activeTestCase = nullptr; m_testCaseTracker = nullptr; return deltaTotals; }
MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent) , m_editor(0) , m_hooqPlayInjector(new PlatformInjector(this)) , m_hooqRecordInjector(new PlatformInjector(this)) , m_hooqLogger(0) , m_hooqPlayer(0) , m_interpreter(new Interpreter(this)) , m_server(new QTcpServer(this)) , m_testModel(new TestModel(this)) , m_testRunning(false) , m_testResultsWindow(new TestResultsDialog(this)) , m_xmlDump(0) { if(!m_interpreter->haveRequiredQtScriptExtensions()) { QMessageBox::critical(0, tr("Couldn't load required QtScript extensions"), tr("Please install qtscriptgenerator for the version of Qt you are currently using. While recording in Hooq may work, playback will not be possible.")); } if(!m_server->listen(QHostAddress::LocalHost, Hooq::Communication::serverPort())) { QMessageBox::critical(0, tr("Couldn't listen for applications"), tr("Hooq couldn't start listening for applications; you're probably running two copies of Hooq. Hooq will not work.")); } m_editor = new ScriptEditor(m_interpreter->engine()); setupUi(this); setStatusBar(0); populateTestSets(); m_testList->setModel(m_testModel); PushButtonDelegate* delegate = new PushButtonDelegate(m_testList, this); delegate->addButton(1, QApplication::style()->standardIcon(QStyle::SP_MediaPlay)); delegate->addButton(2, QApplication::style()->standardIcon(QStyle::SP_FileIcon)); m_testList->setItemDelegate(delegate); m_testList->header()->setResizeMode(0, QHeaderView::Stretch); m_testList->header()->setResizeMode(1, QHeaderView::Fixed); m_testList->header()->setResizeMode(2, QHeaderView::Fixed); m_testList->header()->setStretchLastSection(false); m_contextMenu = new QMenu(this); m_contextMenu->addAction(tr("Run"), this, SLOT(runCurrentTest())); m_contextMenu->addAction(tr("Edit"), this, SLOT(editCurrentTest())); m_contextMenu->addSeparator(); m_contextMenu->addAction(tr("Delete"), this, SLOT(deleteCurrentTest())); setTestSet(m_testSetEdit->currentText()); m_testList->setContextMenuPolicy(Qt::CustomContextMenu); QObject* deleteObserver = new ModelIndexKeyEventObserver(QKeySequence::Delete, m_testList); connect( deleteObserver, SIGNAL(released(QModelIndex)), SLOT(deleteCurrentTest()) ); connect( m_testList, SIGNAL(customContextMenuRequested(QPoint)), SLOT(showTestContextMenu(QPoint)) ); connect( m_testSetEdit, SIGNAL(activated(QString)), SLOT(setTestSet(QString)) ); connect( m_runAllButton, SIGNAL(clicked()), SLOT(runAllTests()) ); connect( m_addTestButton, SIGNAL(clicked()), SLOT(startRecording()) ); connect( m_hooqRecordInjector, SIGNAL(finished(int)), SLOT(finishRecording()) ); connect( m_testNameEdit, SIGNAL(textChanged(QString)), SLOT(updateActionStates()) ); connect( m_addTestSetButton, SIGNAL(clicked()), SLOT(addTestSet()) ); connect( m_newTestSet, SIGNAL(triggered()), SLOT(addTestSet()) ); connect( m_editTestSet, SIGNAL(triggered()), SLOT(editTestSet()) ); connect( m_removeTestSet, SIGNAL(triggered()), SLOT(removeTestSet()) ); connect( m_exportSet, SIGNAL(triggered()), SLOT(exportCurrentSet()) ); connect( m_importSet, SIGNAL(triggered()), SLOT(importTestSet()) ); connect( m_editor, SIGNAL(pickRequested()), m_interpreter, SLOT(pickObject()) ); connect( m_editor, SIGNAL(startRequested()), SLOT(runEditorTest()) ); connect( m_editor, SIGNAL(exceptionThrown(QString, QStringList)), SLOT(logException(QString, QStringList)) ); connect( m_interpreter, SIGNAL(objectPicked(ObjectInformation)), m_editor, SLOT(objectPicked(ObjectInformation)) ); connect( m_interpreter, SIGNAL(objectNotFound(QString)), m_editor, SLOT(objectNotFound(QString)) ); connect( m_interpreter, SIGNAL(executionFailed(int)), m_editor, SLOT(handleApplicationExit(int)) ); connect( m_interpreter, SIGNAL(finished()), SLOT(testFinished()) ); connect( m_interpreter, SIGNAL(startApplicationAndAttach()), SLOT(startApplication()) ); connect( m_quit, SIGNAL(triggered()), qApp, SLOT(quit()) ); connect( m_aboutQt, SIGNAL(triggered()), qApp, SLOT(aboutQt()) ); connect( m_about, SIGNAL(triggered()), SLOT(about()) ); ColumnClickMapper* mapper = new ColumnClickMapper(m_testList); mapper->addMapping(1, this, SLOT(runTestScript(QModelIndex))); mapper->addMapping(2, this, SLOT(editTestScript(QModelIndex))); updateActionStates(); }