开发者

Selenium: Exporting test results

When running test cases in Selenium IDE I see that each step result is logged in the Log tab. Example:

# [info] Executing: |store | //html/body/div[3]/table/tbody/tr/td[3]/a/img | |
# [info] Executing: |store | | |
# [info] Executing: |verifyText | //td[1]/div | Recommended for you |
# [error] Actual value 'Recommended items' did not match 'Recommended for you'
# [info] Changed test case
# [info] Executing: |clickAndWait | link=My Downloads | |
# [info] Changed test case
# [info] Executing: |waitForPageToLoad | | |
# [info] Executing: |verifyTitle | My Downloads | |
# [info] Executing: |verifyElementPresent | //input[contains(@src,'/ndmns/../images/wap2/img/framework/search_button.png')] | |
# [info] Executing: |verifyElementPresent | //img[contains(@src,'ad-banners/banner_ideas_240x40.jpg')] | |
# [error] false
# [info] Executing: |verifyTextPresent | My Downloads | |
# [info] Executing: |verifyElementPresent | //img[contains(@src,'/images/wap2/img/button_redownload.png')] | |

http://img839.imageshack.us/img839/5646开发者_JS百科/testresultsv.jpg

Currently, to send the results to the development team I copy them directly from the IDE into a file (Ctrl+C and Ctrl+V).

Is there a way to tell Selenium to store each test execution into a file?


for selenium IDE version 2.2.0

1) download plugin Test Results (Selenium IDE) from https://addons.mozilla.org/en-us/firefox/collections/samit-badle/samits-selenium-ide-plugins/

2) after installing plugin u can see option in selenium list "File-Export test case results"

3) click on File-Export Test case results

4) save result file as .html

Hope this helps u all :):)


This is where using something like Selenium RC starts showing that it is a better variant than Selenium IDE.

If you have your tests run by a programming language then you can use a testing framework that will tell you what passed and fails and can be merged into a CI process so that when something fails the entire team can see the issue.

You can also use logging in your tests that in a programming language to log exactly what you want and take decent screenshots when there is error.

Selenium IDE allows you to export your tests to decent programming languages.

p.s. running your tests in a programming language will also help with maintainability!


Try exploring TestNG as a framework, with ReportNG for reporting. Results can be output to any location in a relatively easy-to-read HTML document


You might like to look at Molybdenum: http://www.molyb.org/confluence/display/molyb/Features+Molybdenum

Imports Selenium test suites and exports a nice HTML/XML report with screenshots for test failures.


Besides what AutomatedTester said, you might like http://blog.reallysimplethoughts.com/2011/10/08/test-results-v1-0-for-selenium-ide-now-available/ and http://blog.reallysimplethoughts.com/2010/08/16/file-logging-extension-for-selenium-ide-v1-6-released/, two logging and exporting plugins for Selenium IDE.

Both found at the official plugin site: http://docs.seleniumhq.org/download/.


Selenium IDE currently supports test formats in several languages (Ruby, Java). Generally the export scripts are formatted to work within an existing unit testing framework (in Java, for example, the choices are JUnit & TestNG).

The export options also include some choice regarding what Selenium engine will run the tests. I prefer to use the WebDriver. Selenium WebDriver + JUnit is a very lightweight and powerful combination.

Results can then be collected by running a test suite. The code will look something like this with some additional file I/O.

package de.vogella.junit.first;

import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
import org.junit.runner.notification.Failure;

public class MyTestRunner {
  public static void main(String[] args) {
    Result result = JUnitCore.runClasses(MyClassTest.class);
    for (Failure failure : result.getFailures()) {
      System.out.println(failure.toString());
    }
  }
}

(code quoted from http://www.vogella.com/articles/JUnit/article.html#juniteclipse_code)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜