Showing posts with label Selenium RC. Show all posts
Showing posts with label Selenium RC. Show all posts

Monday, March 7, 2011

Generating JUnit Report

1. Select File menu and click on "Export" option

Figure: Export window
2. Expand "General" node and select "Ant Buildfiles", click on "Next" button

3. Select the project (let all default options), click on "Finish" button
Figure: Ant Buildfiles
4. build.xml file should be created under project folder

5. Now we need to add junit jar file in Ant's "Global Entires"

6. Select "Window" menu, click on "Preferences"

7. In "Preferences" window, expand "Ant" root node, click on "Runtime"

8. Click on "Classpath" tab, expand "Global Entires" 

9. Click on "Add External JARs" button



10. Navigate to your "eclipse" directory (where eclipse is installed). Select "plugins ->org.junit_3.8.2.v3_8_2_v20100427-1100" directory. Select junit.jar file

11. Now right click on build.xml file and select Run As -> Ant Build.."

12. In "Edit Configuration and launch" window, select "build", "SmokeTestSuite" and "junitreprot" checkboxes and click on "Run" button
Figure: Edit Configuration



13. All your test scripts will run and finally report will be generated under the same project directory under "junit" folder

14. Click on "index.html", you will see the report 

Friday, March 4, 2011

Creating Selenium RC - JUnit Test Suite using Eclipse IDE

1. Create JUnit test cases as illustrated here

2. To create a JUnit test suite, right click on the project select New -> Class

3. Enter the class name as SmokeTestSuite and click on "Finish" button

4. Copy the following code and paste in the above class

package actItTimeSmokeTest;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;

@RunWith(Suite.class)
@Suite.SuiteClasses({JUnitTestCase_01.class, JUnitTestCase_02.class, JUnitTestCase_03.class})
public class SmokeTestSuite {
}

5. To run the test suite, right click on the SmokeTestSuite file and select Run As -> JUnit Test

6. The test suite file will run all the 3 tests and gives the results. Following is the JUnit test result for test suite
Figure: JUnit Test Suite Results

Thursday, March 3, 2011

Running a Selenium RC - JUnit Test Case in Eclipse IDE

1. Create a JUnit test case as illustrated here

2. Select the test case which you want to run individually (.java file), right click on it.

3. Select Run As -> JUnit Test (see below figure)
Figure: Running JUnit Test Case
4. The test results can be viewed under JUnit window (see below screen shot)
Figure: JUnit Test Result

Creating a Selenium RC - JUnit Test Case in Eclipse IDE

1. Open Eclipse IDE
2. Create a project
3. Create a package
4. Add JUnit, selenium-server jar files to build path
5. Right click on the project and select New -> JUnit Test Case (as shown in following figure)
Figure: JUnit Test case
6. In the "New JUnit Test Case" window, enter "Source folder", "Package" and "Name". Here name is java class name.
Figure: New JUnit Test Case
7. Now, copy and paste the following code into your test case
Figure: JUnitTestCase_01
8. Similarly, create the following test cases
Figure: JUnitTestCase_02
Figure: JUnitTestCase_03

Monday, February 21, 2011

Installing Selenium RC

1. You can download Selenium RC 1.0.3 from here

2. Save it to C:\Selenium

3. Unzip this into a folder of the same name as the the archive
Figure: Downloaded Selenium Directory
4. Now the C:\selenium folder should look like this.

Figure: Contents OF Selenium RC
Overview of the contents of Selenium

We can see the extracted archive Selenium Remote Control has a lot of folders extracted.

There are two main folder types here:
• specific language client drivers
• selenium server

Each of the supported languages has a client driver. You can see from the list of folders that the
Selenium distribution supports:
• Microsoft .Net
• Java
• Perl
• PHP
• Python and
• Ruby

The client drivers are what we use in our tests to communicate with Selenium-RC. We use the client drivers because our tests act as clients, which communicate with the server, in order to execute commands through the browser.

The client drivers contain the source code, tests, documentation and libraries that we need to work with the Selenium tests.

The selenium server directory has the documentation, source code, tests and executables for working with the Selenium server.

Friday, January 7, 2011

Starting Selenium Server

Starting Selenium Server Method1:

1. Start -> Run. Open command prompt 

Figure: Command Prompt
2. Type java -jar

3. Drag the selenium-server.jar file from the directory it is located. (see the below figures)

Figure: Location of selenium-server.jar file
Figure: After Drag and drop to command prompt
4. Press Enter button

5. Now Selenium RC is ready and you can execute selenium test cases.

6. Your command prompt should look like this.

Figure: Selenium Server