Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6688147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:22:15+00:00 2026-05-26T05:22:15+00:00

I’ve gone through various tutorials and Stack Overflow posts and understand that Selenium can

  • 0

I’ve gone through various tutorials and Stack Overflow posts and understand that Selenium can output XML test results in a way that Hudson can read/report them in HTML format.

What I don’t understand is the syntax to use in Python, to get the results to look something like:
Testcase_LoginPage.VerifyButton1Present fail

Testcase_LoginPage.VerifyButton2Present pass

Currently, when I drill down the results in Hudson, they won’t be formatted in a useful way as I described above, and also it will report that it only ran ONE test, even though it ran multiple assert Tests:

Traceback (most recent call last):
File “D:\Temp\1TestingApps\Selenium\Scripts\SampleScripts\SamCodeSample\test\SOreports.py”, line 22, in tearDown
self.assertEqual([], self.verificationErrors)
AssertionError: Lists differ: [] != [‘Sign Up button issue2’]

Second list contains 1 additional elements.
First extra element 0:
Sign Up button issue2

  • []
  • [‘Sign Up button issue2’]

Ran 1 test in 13.610s

FAILED (errors=1)

Generating XML reports…

Code is below. Thanks in advance for the help!

from selenium import selenium
import unittest, xmlrunner, os, re

class Demo(unittest.TestCase):

def setUp(self):
    self.verificationErrors = []
    self.selenium = selenium("localhost", 4444, "*chrome", "https://workflowy.com/")
    self.selenium.start()

def test_hh(self):
    sel = self.selenium
    sel.open("/accounts/register/")
    try: self.assertEqual("Sign Up FAIL", "Sign Up FAIL","Sign Up button issue1")
    except AssertionError, e: self.verificationErrors.append(str(e))
    try: self.assertEqual("Sign Up FAIL", "Sign Up FAIL1","Sign Up button issue2")
    except AssertionError, e: self.verificationErrors.append(str(e))

def tearDown(self):
    self.selenium.stop()
    self.assertEqual([], self.verificationErrors)
if __name__ == "__main__":
#have to format the code this way as SO is complaining about 'bad indent'
    unittest.main(testRunner=xmlrunner.XMLTestRunner(output='test-reports'))
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T05:22:15+00:00Added an answer on May 26, 2026 at 5:22 am

    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.

    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
    – Added error descriptions that include the testcase name via inspect.stack()


    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'))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a French site that I want to parse, but am running into
I'm parsing an XML file, the creators of it stuck in a bunch social
Seemingly simple, but I cannot find anything relevant on the web. What is the
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.