1

I implemented Selenium IDE on Firefox on a server and, because I don't always wanna start a connection to the server to check the results, would like to get something like a test report via mail, if (only if) a failure occurred.

I couldn't find a good solution so far and would be glad, if you could help.

First problem here would be to detect, IF a failure occured while running the test cases. There seems to be no command for that. I tried assertAlertPresent but that's not detecting failures. If anyone could help me, solving this first problem, I would be already one huge step further.

  • Didn't they used to have an addon from Mozilla for that? Have you checked that? – demouser123 Feb 26 '16 at 13:57
1

I usually run all the automation tests through Jenkins and, when a test case fails, you can configure the tool to send an email with all the information you need.

0

@Borja - Her question was related to selenium IDE , Elisa is not working with Selenium WebDriver or programming script explicitly , Jenkins job you can't run in air without build or substantial framework in place ,hence your answer is irrelevant to me.

@ Elisa , you can use Selenium WebDriver , and create framework and then make build of it via maven or ant , and can run periodically on Jenkins, Its mammoth task , if you want to automate all testing , but worth investing.

0

Let me try to give you a very simple example to verify something with Selenium IDE.

I just used Selenium IDE to record a very simple scenaio (go to google.com, type "Selenium" in the search box, that's it). Then saved in python2/webdriver and get the main test method as following.

def test_(self):
    driver = self.driver
    driver.get(self.base_url + "<masked>")
    driver.find_element_by_id("lst-ib").clear()
    driver.find_element_by_id("lst-ib").send_keys("Selenium")

This is all good, not much can fail here. But imagine you want to verify the search box does contain the word "Selenium" after these steps. What you can do is -- while the recording is still running, right click the Google search box, near to bottom of the menu you should see something like "verify ...". Click it, save the script then you should get something like the following. (note, the IDE actually tries to guess what you want to verify, so most of the time the suggestion (i.e. the verify in this example) is good enough.)

def test_(self):
    driver = self.driver
    driver.get(self.base_url + "<masked>")
    driver.find_element_by_id("lst-ib").clear()
    driver.find_element_by_id("lst-ib").send_keys("Selenium")
    try: self.assertEqual("Selenium", driver.find_element_by_id("lst-ib").get_attribute("value"))
    except AssertionError as e: self.verificationErrors.append(str(e)

The only addition is the Try/Except block. This means, if the search box doesn't contain "Selenium" then this test is considered "failed". There are more assertions/other methods you can use to make your failure criteria if you choose the "Show All Available Commands".

As to reporting, if you don't mind too many emails, you can just add the python code to send you an email after the "as:". Then each failure will generate an email to you. Althernatively, in the as: section append the testcase name, and other info you want, to a text file. And have your test driver to send you an email with the content after all testcases are done. This way you get one email with all the failures in a run. This is not the best way, but it works with the least coding.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.