sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #41757
[Question #521200]: setUpClass does not run with HTMLTestrunner
New question #521200 on Sikuli:
https://answers.launchpad.net/sikuli/+question/521200
Attempted to run a test scenario/Testcase using the setUpClass(cls) and tearDownClass python unittest methods.
Note: The same script works using setUp(self) and tearDown(self) method. However the setup/teardown is called at every test_ def.
When running with the setUpClass(cls) and tearDownClass the following error is produced, from what I believe is an error in the HTMLTestrunner.
"[error] AttributeError ( '_TestResult' object has no attribute 'outputBuffer' )
[error] --- Traceback --- error source first
line: module ( function ) statement
594: HTMLTestRunner ( complete_output ) AttributeError: '_TestResult' object h
s no attribute 'outputBuffer'
198: suite ( _addClassOrModuleLevelException ) File "C:\Sikuli\sikulix.jar\L
b\HTMLTestRunner.py", line 620, in addError
100: suite ( run ) File "C:\Sikuli\sikulix.jar\Lib\unittest\suite.py", line
53, in _handleClassSetUp
678: HTMLTestRunner ( run ) File "C:\Sikuli\sikulix.jar\Lib\unittest\suite.p
", line 70, in __call__
[error] --- Traceback --- end --------------
"
Stuck at how to get the outputbuffer attribute triggered. I think I need to edit the complete_output and the addError def in the HTMLTestrunner however I am not sure what to edit.
Here is an example of the script I am attempting to run.
from sikuli import *
import os
import sys
import HTMLTestRunner
import time
import unittest
#import utils
import org.sikuli.basics.SikulixForJython
dir = "C:\Sikuli\Test\Test"
if not dir in sys.path: sys.path.append(dir)
fp = file(os.path.join(dir, "SetupClass_TestReport.html"), "wb")
class TestcaseSetupScenario(unittest.TestCase):
@classmethod
def setUpClass(cls):#(self):
App.open(r'C:\Program Files (x86)\Mozilla Firefox\firefox.exe')
wait(2)
type(Key.F6)
wait(1)
paste(www.google.com)
Debug.info("setUpClass called")
#def setUp(self):
#print "testing 123"
@classmethod
def tearDownClass(cls):#(self):
App.close('Mozilla Firefox')
Debug.info("tearDownClass called")
#def tearDown(self):
#print "321 testing"
def test_step_01(self):
Debug.info("executing test step 1")
wait(7)
assert exists("google_search.png")
def test_step_02(self):
Debug.info("executing test step 2")
type(Key.F6)
paste(www.sikulix.com)
type(Key.ENTER)
wait(3)
assert exists("SikuliX.png")
def test_step_03_(self):
Debug.info("executing test step 3")
assert exists("Sikuli.png")
suite = unittest.TestLoader().loadTestsFromTestCase(TestcaseSetupScenario)
runner = HTMLTestRunner.HTMLTestRunner(stream = fp, verbosity=1, dirTestScreenshots = dir)
runner.run(suite)
--
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.