Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I've finally figured out how to make the verifications and assertions get reported in a useful format for my needs. The problem is that the default structure of the tests when simply exporting a Selenium IDE recorded script into a Python RC file lacks a lot of detail I needed.<br></p> <p>What I changed: - Placed the Selenium start and stop methods in the Setup and tearDown classes which prevented Selenium from restarting the browser with each newly defined verification/assertion method <br> - Added error descriptions that include the testcase name via inspect.stack()</p> <hr> <pre><code>import inspect, unittest, xmlrunner from selenium import selenium class TESTVerifications(unittest.TestCase): @classmethod def setUpClass(self): self.selenium = selenium("localhost", 4444, "*iexplore", "https://workflowy.com/") self.selenium.start() self.selenium.set_timeout("60000") print("setUpClass") self.selenium.window_maximize() self.selenium.open("/") def setUp(self): self.verificationErrors = [] def test_verification1_error(self): try: self.assertEqual("This application is designed", "This application is designedZZZZ",(inspect.stack()[0][3]) +" text missing 'This application is designed'") except AssertionError, e: self.verificationErrors.append(str(e)) def test_verification2_error_two_times(self): sel = self.selenium ##No such element exception try: self.assertEqual("First failure", "First failureZZZZ",(inspect.stack()[0][3]) +" First failure'") except AssertionError, e: self.verificationErrors.append(str(e)) try: self.assertEqual("Second Failure", "Second FailureZZZZ",(inspect.stack()[0][3]) +" Second failure'") except AssertionError, e: self.verificationErrors.append(str(e)) def tearDown(self): #self.selenium.stop() self.assertEqual([], self.verificationErrors,"Results: " + str(self.verificationErrors)) @classmethod def tearDownClass(self): self.selenium.stop() print("tearDownClass") if __name__ == "__main__": # unittest.main() unittest.main(testRunner=xmlrunner.XMLTestRunner(output='test-reports')) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload