QA/Tools/Selenium/AMO Automation: Difference between revisions

From MozillaWiki
< QA
Jump to navigation Jump to search
 
(24 intermediate revisions by one other user not shown)
Line 5: Line 5:
== How to record and play back Selenium IDE scripts ==
== How to record and play back Selenium IDE scripts ==
# Record the script(s) with [http://selenium-ide.openqa.org/ Selenium IDE]
# Record the script(s) with [http://selenium-ide.openqa.org/ Selenium IDE]
## Be sure to record '''relative''', not ''absolute'' paths (i.e. /en-US/firefox/some/AMO/url/, rather than https://preview.addons.mozilla.org/en-US/firefox/some/AMO/url
## Be sure to record '''relative''', not ''absolute'' paths (i.e. /en-US/firefox/some/AMO/url/, rather than https://preview.addons.mozilla.org/en-US/firefox/some/AMO/url)
# Download and install [http://selenium-rc.openqa.org/download.html Selenium RC] -- literally just unzip it into its own folder
### When finished, File | Save Test Case As..., and be sure it has a .HTML extension
## In the root of your Selenium RC folder, create a folder called htmlSuite
# Download and unpack [http://selenium-rc.openqa.org/download.html Selenium RC] -- literally just extract the contents into their own new folder
## Drop your testcase.html file(s) into the htmlSuite directory
## In the root of your Selenium RC folder, create a folder called |htmlSuite|
## In htmlSuite, create an HTML file called testSuite.html, following the markup in [http://wiki.openqa.org/display/SIDE/Automating+Selenium+IDE+tests http://wiki.openqa.org/display/SIDE/Automating+Selenium+IDE+tests]
## Drop your |testcase.html| file(s) into the |htmlSuite| directory
## In |htmlSuite|, create an HTML file called |testSuite.html|, following the markup in [http://wiki.openqa.org/display/SIDE/Automating+Selenium+IDE+tests http://wiki.openqa.org/display/SIDE/Automating+Selenium+IDE+tests]
## Change the |href=| filename attributes to match each of your testcase's filename
## Change the |href=| filename attributes to match each of your testcase's filename
# From the command line, issue: java -jar selenium-server.jar -htmlSuite "*firefox" "https://preview.addons.mozilla.org" [1 -- just a footnote, don't enter me!] "/Users/stephend/Desktop/selenium-remote-control-1.0-SNAPSHOT/htmlSuite/testSuite.html" "/Users/stephend/Desktop/results.html" (substituting, of course, the folder name of your RC version and path/to/tests and path/to/results.html)
# From the command line, CD into the selenium-server folder (something like ~/Desktop/selenium-remote-control-1.0-SNAPSHOT/selenium-server-1.0-SNAPSHOT), and issue:
# If all goes, well, your first testcase will begin running; when it's finished, it'll run the next testcase, and once that's completed, it'll quit Firefox and write out |results.html|
#* java -jar selenium-server.jar -htmlSuite "*chrome" "https://preview.addons.mozilla.org" [1 -- just a footnote, don't enter me!] "/Users/stephend/Desktop/selenium-remote-control-1.0-SNAPSHOT/htmlSuite/testSuite.html" "/Users/stephend/Desktop/results.html" (substituting, of course, the folder name of your RC version and path/to/tests and path/to/results.html)
# If all goes, well, your first testcase will begin running; when it's finished, it'll run the next testcase, and once that's completed, it'll quit Firefox and write out |results.html| -- sample [http://people.mozilla.com/~sdonner/selenium/results.html results.html]


[1] This is the base URL, and what your test scripts will key off of
[1] This is the base URL, and what your test scripts will key off of
== Testcases I'm working on ==
[http://svn.mozilla.org/addons/trunk/site/app/tests/search.html Search]<br>
[http://svn.mozilla.org/addons/trunk/site/app/tests/amo-selenium.html General]


== Sounds great and all, but what does this do for / how does this help AMO? ==
== Sounds great and all, but what does this do for / how does this help AMO? ==


# The idea is to not regress critical things like search, other functionality/page views
Pros:
# Limitation: not a unit test
# The idea is not to regress critical things like search, other functionality/page views
# Should let us focus on verifying new functionality works as expected
# Rapid turnaround on automating user actions
 
Cons:
# Not a substitute for a unit test
# Can't really test layout well
# Want to use the |pause| command?  Too bad; it apparently [http://jira.openqa.org/browse/SIDE-204 doesn't work] :-(

Latest revision as of 23:31, 21 July 2009

Selenium IDE/RC and AMO, or: How I Learned to Stop Worrying and Love Automation

Questions? Feedback/suggestions? Email stephend@mozilla.com

How to record and play back Selenium IDE scripts

  1. Record the script(s) with Selenium IDE
    1. Be sure to record relative, not absolute paths (i.e. /en-US/firefox/some/AMO/url/, rather than https://preview.addons.mozilla.org/en-US/firefox/some/AMO/url)
      1. When finished, File | Save Test Case As..., and be sure it has a .HTML extension
  2. Download and unpack Selenium RC -- literally just extract the contents into their own new folder
    1. In the root of your Selenium RC folder, create a folder called |htmlSuite|
    2. Drop your |testcase.html| file(s) into the |htmlSuite| directory
    3. In |htmlSuite|, create an HTML file called |testSuite.html|, following the markup in http://wiki.openqa.org/display/SIDE/Automating+Selenium+IDE+tests
    4. Change the |href=| filename attributes to match each of your testcase's filename
  3. From the command line, CD into the selenium-server folder (something like ~/Desktop/selenium-remote-control-1.0-SNAPSHOT/selenium-server-1.0-SNAPSHOT), and issue:
    • java -jar selenium-server.jar -htmlSuite "*chrome" "https://preview.addons.mozilla.org" [1 -- just a footnote, don't enter me!] "/Users/stephend/Desktop/selenium-remote-control-1.0-SNAPSHOT/htmlSuite/testSuite.html" "/Users/stephend/Desktop/results.html" (substituting, of course, the folder name of your RC version and path/to/tests and path/to/results.html)
  4. If all goes, well, your first testcase will begin running; when it's finished, it'll run the next testcase, and once that's completed, it'll quit Firefox and write out |results.html| -- sample results.html

[1] This is the base URL, and what your test scripts will key off of

Testcases I'm working on

Search
General

Sounds great and all, but what does this do for / how does this help AMO?

Pros:

  1. The idea is not to regress critical things like search, other functionality/page views
  2. Should let us focus on verifying new functionality works as expected
  3. Rapid turnaround on automating user actions

Cons:

  1. Not a substitute for a unit test
  2. Can't really test layout well
  3. Want to use the |pause| command? Too bad; it apparently doesn't work :-(