I have a simple defined as below

from unittest import TestLoader, TestSuite, TextTestRunner
from TestScripts.LogOn import test_1
from TestScripts.FirstLog import test_2



if __name__ == "__main__":

    loader = TestLoader()
    suite1 = TestSuite((
        loader.loadTestsFromTestCase(test_1),
        loader.loadTestsFromTestCase(test_2)
        ))


    xrunner = TextTestRunner(verbosity=2)
    xrunner.run(suite1)

When ever I run, I get below error for first test of test class test_1

 .common.exceptions.UnexpectedAlertPresentException: Alert Text: None
Message: 

But If I comment one of imports (either test_1 or Test_2) and avoid respective test loading to suite, work perfectly. in other words individual test working OK.

If I import both test_1 and test_2 classes, and load only one, same problem occurs i.e. disregards to test loading all imported classes were run and gets the error.

What am’I doing wrong? how to correct it?

I’m developing and test using eclipse with PyDev

additional….
my classes are derived as below base class….

class BaseTestCase(unittest.TestCase):

    def setUp(self):
        self.driver = DRIVER
        self.driver.implicitly_wait(3)

    def tearDown(self):
        #self.driver.quit()
        pass    


def getFoxDriver():
    ffdrive= webdriver.Firefox()
    ffdrive.get('http://localhost/balbla../')
    time.sleep(20)
    return ffdrive    

DRIVER = getFoxDriver()



Source link https://sqa.stackexchange.com/questions/32710/running--selenium-test-as-suite

LEAVE A REPLY

Please enter your comment!
Please enter your name here