Пример #1
0
def suiteRunner(patternString):
    bot = TelegramBot()
    patternTests = ''

    if patternString == 'all':
        patternTests = '*.py'
    else:
        patternTests = '*' + patternString + '*.py'

    tests = unittest.TestLoader().discover('.', pattern=patternTests)

    unittest.TextTestRunner.resultclass = Resulter

    reporter = Reporter.createInstance('Reports', patternString)

    resulter = unittest.TextTestRunner(verbosity=1).run(tests)

    # Make report and send notification if there're an errors or failures
    if len(resulter.errors) > 0 or len(resulter.failures) > 0:
        reporter.makeReport(resulter)

        bot.sendMessage('Errors:\n' + str(len(resulter.errors)) +
                        '\nFailures:\n' + str(len(resulter.failures)) +
                        '\nSkipped:\n' + str(len(resulter.skipped)) +
                        '\nTestCount:\n' + str(resulter.testsRun))
        bot.sendDocument(reporter.getReportFileName())

    WebDriverWrapper.getInstance().quit()
Пример #2
0
 def addError(self, test, err):
     testName = str(test._testMethodName)
     WebDriverWrapper.getInstance().getScreenShotAsFile(
         Reporter.getInstance().getReportFolder() + '/' + testName +
         '_Error.png')
     super().addError(test, err)
Пример #3
0
 def startTest(self, test):
     WebDriverWrapper.getInstance().deleteAllCookies()
Пример #4
0
 def setUp(self):
     self.webDriver = WebDriverWrapper.getInstance()