Showing posts with label Eclipse. Show all posts
Showing posts with label Eclipse. 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 

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

Wednesday, March 2, 2011

Adding JUnit Library to Eclipse Build Path

1. Download JUnit jar file

2. Open Eclipse IDE

3. Create a Java Project if you have not already created (Refer here)

4. Right click on the project and select "Properties"

5. In "Properties" window, select "Java Build Path" from right side tree

6. Click on "Libraries" tab

7. Click on "Add External Jars" button (See the below figure)
Figure: Build Path
8. Move to the location where junitx.jar file is located and add, click on "OK" button

9. A new node called "Referenced Libraries" must be created and JUnit jar file must be added into that as shown below
Figure: JUnit jar fiel ubder Referenced Libraries
Now, we can write JUnit test case.

Monday, February 28, 2011

Creating a Java Package in Eclipse IDE

1. Run Eclipse IDE

2. Create a new Java Project (Refer here)

3. Right click on "src", select New -> Package
Figure: New Package in Eclipse
3. Enter package name and click on "Finish" button
Figure: Java Package Wizard
4. Now, Java package has been created
Figure: Java Package

Creating a New Java Project in Eclipse IDE

1. Open Eclipse IDE

2. Click on File -> New -> Java Project as shown in the following figure
Figure: Creating Java Project
3. Enter "Project name" and click on "Finish" button
Figure: Eclipse "New Java Project" page
That's it!! New project has been created in Eclipse IDE

Wednesday, February 23, 2011

Running/Opening Eclipse IDE

1. Run eclipse by double clicking on “eclipse.exe”
Figure: Eclipse IDE exc
2. From the "Workspace Launcher", choose a "workspace" (It is the folder where your projects files will be stores) Ex: D:\EclipseWorkSpace\. Click on "OK" button.
Figure: Eclipse Workspace
3. You will see a Eclipse Welcome Screen. Click on "Workbench", which is highlighted in the following figure.
Figure: Select Workbench
4. And then you will see the eclipse workbench screen
Figure: Eclipse Workbench Screen

Tuesday, February 22, 2011

Installing Eclipse

1. Goto http://www.eclipse.org/ and click on the big download button
Figure: Eclipse Download Link
2. Download the "Eclipse IDE for Java Developers" 
Figure: Eclipse for Windows OS
3. Download the zip file and save it to a folder

4. Unarchive the zip file. The Eclipse folder should look like this.
Figure: Downloaded Eclipse Folder
Thats it, you have downloaded the Eclipse IDE