def runTestSuite(self): # call static method of the base class for all Sahana test case classes # this method will ensure that one Selenium instance exists and can be shared SahanaTest.setUpHierarchy(self.radioB.get(), self.browserPath.get(), self.ipAddr.get(), self.ipPort.get(), self.URL.get() + self.app.get()) # SahanaTest.useSahanaAccount(self.adminUser.get(), # self.adminPassword.get(), # ) self.clean = False testConfig = TestConfig() testModuleList = self.getTestCasesToRun() testConfig.test_main(testModuleList, self.radioB.get()) call(["firefox", os.path.join("..", "results", testConfig.fileName)]) if (not self.keepOpen): SahanaTest.selenium.stop( ) # This will close the Selenium/Browser window self.clean = True
def runTestSuite(self): # call static method of the base class for all Sahana test case classes # this method will ensure that one Selenium instance exists and can be shared SahanaTest.setUpHierarchy(self.radioB.get(), self.browserPath.get(), self.ipAddr.get(), self.ipPort.get(), self.URL.get() + self.app.get() ) #SahanaTest.useSahanaAccount(self.adminUser.get(), # self.adminPassword.get(), # ) self.clean = False testConfig = TestConfig() testModuleList = self.getTestCasesToRun() testConfig.test_main(testModuleList, self.radioB.get()) call(["firefox", os.path.join("..", "results", testConfig.fileName)]) SahanaTest.selenium.stop() # Debug: Comment out to keep the Selenium window open self.clean = True
return values #class UserManagementCreate(UserManagement): def test_addUser(self): pass def test_deleteUser(self): pass def test_checkUser(self): pass #class UserManagementFinal(UserManagement): # def test_del_users(self): def lastRun(self): sel = self.selenium self.useSahanaAdminAccount() self.action.login(self._user, self._password ) print "Test script to Delete test users" for user in UserManagement.users: self.action.delUser(user) self.action.clearSearch() sel.click("link=Logout") sel.wait_for_page_to_load("30000") if __name__ == "__main__": SahanaTest.setUpHierarchy() unittest.main() OrganisationTest.selenium.stop()
from mainWindow import TestWindow from testConfig import TestConfig if __name__ == "__main__": # Do we have any command-line arguments? args = sys.argv if args[1:]: # Yes: we are running the tests from the CLI (e.g. from Hudson) # The 1st argument is taken to be the config file: config_filename = args[1] exec("from %s import Settings" % config_filename) testSettings = Settings() browser = testSettings.radioB SahanaTest.setUpHierarchy(browser, testSettings.browserPath, testSettings.ipAddr, testSettings.ipPort, testSettings.URL + testSettings.app ) # When running non-interactively, Username/Password are blank SahanaTest.useSahanaAccount("", "", ) testConfig = TestConfig() moduleList = testConfig.getTestModuleDetails() testList = testConfig.getTestCasesToRun(moduleList) suite = testConfig.suite for testModule in testList: # dotted notation module.class testConfig.overrideClassSortList(testModule["class"], testModule["tests"]) # Invoke TestRunner buf = StringIO.StringIO()
from sahanaTest import SahanaTest import unittest import actions class DummyTest(SahanaTest): """ suite of dummy classes used for testing the test framework """ _sortList = ("test_One", "test_Two") def test_One(self): self.assertEqual("one", "one") def test_Two(self): self.assertEqual("two", "two") def test_Three(self): self.assertEqual("three", "three") def test_Four(self): self.assertEqual("four", "four") def test_Five(self): self.assertEqual("five", "five") def test_Six(self): self.assertEqual("six", "six") if __name__ == "__main__": SahanaTest.setUpHierarchy() unittest.main()
args = sys.argv if args[1:]: # Yes: we are running the tests from the CLI (e.g. from Hudson) # The 1st argument is taken to be the config file: config_filename = args[1] path = os.path.dirname(os.path.abspath(__file__)) os.chdir(path) sys.path = [path] + [os.path.join(path, "config") ] + [p for p in sys.path] exec("from %s import Settings" % config_filename) testSettings = Settings() browser = testSettings.radioB SahanaTest.setUpHierarchy(browser, testSettings.browserPath, testSettings.ipAddr, testSettings.ipPort, testSettings.URL + testSettings.app) # When running non-interactively, Username/Password are blank SahanaTest.useSahanaAccount( "", "", ) testConfig = TestConfig() moduleList = testConfig.getTestModuleDetails() testList = testConfig.getTestCasesToRun(moduleList) suite = testConfig.suite for testModule in testList: # dotted notation module.class testConfig.overrideClassSortList(testModule["class"], testModule["tests"]) # Invoke TestRunner buf = StringIO.StringIO()
chk.grid(row=i//2, column=i%2*2, sticky=NW) i += 1 if __name__ == "__main__": # Do we have any command-line arguments? args = sys.argv if args[1:]: # Yes: we are running the tests from the CLI (e.g. from Hudson) # The 1st argument is taken to be the config file: config_filename = args[1] exec("from %s import Settings" % config_filename) testSettings = Settings() browser = testSettings.radioB SahanaTest.setUpHierarchy(browser, testSettings.browserPath, testSettings.ipAddr, testSettings.ipPort, testSettings.URL + testSettings.app ) #SahanaTest.useSahanaAccount(testSettings.adminUser, # testSettings.adminPassword, # ) testConfig = TestConfig() moduleList = testConfig.getTestModuleDetails() testList = testConfig.getTestCasesToRun(moduleList) suite = testConfig.suite for testModule in testList: # dotted notation module.class testConfig.overrideClassSortList(testModule["class"], testModule["tests"]) # Invoke TestRunner buf = StringIO.StringIO() try: report_format = args[2]