I repeat the text file.
each line in the text file of the file is the name of the test.
I am trying to instantiate a testing class, but I keep getting this error:
ValueError: no such test method in <class 'login_to_blog'>: runTest
The code where I do this is:
test_name = line.replace("\n", "") #name of test file, class, and method _must_ be shared. module = __import__(test_name) test_class = getattr(module, test_name) suite.addTest(test_class())
here is login_to_blog:
from selenium import selenium import unittest, time, re class login_to_blog(unittest.TestCase): def setUp(self): self.verificationErrors = [] self.selenium = selenium("localhost", 4444, "*chrome", "http://blog/") self.selenium.start() def test_login_to_blog(self): sel = self.selenium sel.open("/") sel.type("signin_username", "jim") sel.type("signin_password", "jones") sel.click("//input[@value='Signin']") sel.wait_for_page_to_load("30000") try: self.failUnless(sel.is_text_present("your blog posts")) except AssertionError, e: self.verificationErrors.append(str(e)) def tearDown(self): self.selenium.stop() self.assertEqual([], self.verificationErrors) if __name__ == "__main__": unittest.main()
It is important to note that these tests are successfully performed by them through the command line.
any idea how i can create and run them manually from python code?
source share