PMC:QA:selenium

From ADempiere
Jump to: navigation, search
This Wiki is read-only for reference purposes to avoid broken links.

Selenium Projects

Selenium has many projects that combine to make a versatile testing system.

more please review

http://seleniumhq.org/projects/

http://seleniumhq.org/docs/01_introducing_selenium.html#id1

Selenium IDE

Selenium IDE is a Firefox add-on that makes it easy to record and playback tests in Firefox 2+. You can even use it generate code to run the tests with Selenium Remote Control.

Selenium RC

Selenium Remote Control is a client/server system that allows you to control web browsers locally or on other computers, using almost any programming language and testing framework.

Selenium Grid

extends Selenium RC to distribute your tests across multiple servers, saving you time by running tests in parallel.

Selenium RC

Selenium RC Installation

download

download Selenium RC from http://seleniumhq.org/download/ or download previous versions from http://seleniumhq.org/download/previous.html

start Selenium server

extract selenium-remote-control-xxx.zip

  • start server by:
java -jar selenium-server.jar
  • you'll get info as follow:

Sele.png

Note:For the server to run you’ll need Java installed,and java needs to be 1.5 or later

You can check that you have Java correctly installed by running the following on a console:

java -version

Sele1.png

From Selenese to a Program(via Selenium IDE)

The primary task for using Selenium-RC is to convert your Selenese into a programming language.

Sample Test Script

Let’s start with an example Selenese test script.

Selenium IDE

   * install Selenium IDE

goto download page:http://seleniumhq.org/download/

select Selenium IDE,then it will pop up a installation window,install it and restart your Firefox.

   * Opening the IDE

To run the Selenium-IDE, simply select it from the Firefox Tools menu. It opens as follows with an empty script-editing window and a menu for loading, or creating new test cases.

Sele2.png

   * Imagine recording the following test with Selenium-IDE.

Sele3.png

Selenese as Programming Code

Selenese as java Programming Code

at selenioum IDE tools,select Options -> Format -> java(Junit)

Sele4.png

Using the Java Client Driver

Java Client Driver Configuration

In General configuration of Selenium-RC with any java IDE would have following steps:

   1 Download Selenium-RC from the SeleniumHQ downloads page
   2 Start any java IDE
   3 Create new project
   4 Add to your project classpath selenium-java-client-driver.jar
   5 Record your test from Selenium-IDE and translate it to java code (Selenium IDE has automatic translation feature to generate tests in variety of languages)
   6 Run selenium server from console
   7 Run your test in the IDE

here i configurate Selenium-RC With Eclipse.

Configuring Selenium-RC With Eclipse:please refer to http://seleniumhq.org/docs/appendix_installing_java_driver_client.html#configuring-selenium-rc-eclipse-reference

Run selenium server from console

Run test case in the Eclipse IDE:

Sele5.png

  • the info from console

Sele6.png

  • and the open window

Sele7.png

Problems:

maybe you should get problems in selenium server console:

15:44:58.067 WARN - Caution: '/usr/bin/firefox': file is a script file, not a real executable. The browser environment is no longer fully under RC control

solution:

please refer to:

Selenium rc Interactive Mode

start Selenium Server

   * start Selenium rc server with:
java -jar selenium-server.jar -interactive

then you will get information as follow:

Sele8.png

test Interactive Mode

now let's run some commands to view Selenium rc Interactive Mode

  • try the first command
cmd=getNewBrowserSession&1=*firefox&2=http://www.google.com

Sele9.png

Sele10.png

  • command 2

open page http://google.com

cmd=open&1=http://www.google.com/webhp&sessionId=606401

Sele11.png

Sele12.png

  • command 3
cmd=type&1=q&2=selenium rc&sessionId=606401

Sele13.png

Sele14.png

  • command 4
cmd=click&1=btnG&sessionId=606401

Sele15.png

Sele16.png

References

Links