Sunday, November 14, 2010

Selenium Framework1 : Selenium IDE,RC,ANT,TestNG, Eclipse IDE

Architecture:
Using this framework we can run tests from command line or from eclipse IDE.
This framework uses Selenium IDE,RC,ANT,TestNG, Eclipse IDE.

Selenium IDE: selenium IDE used to record a testcase, exporting it into Java.
Selenium RC:Converted test case in java can be executed using selenium RC. 
TestNG: tesNG is used for configuration and report results.
ANT: This build tool is to execute tests from command line.

Setup:

1. Install JDK. Here is the link to install JDK.
2. Install ANT. Here is the link to install Ant.
3. Install Eclipse. Here is the link.
4. Install testNG Eclipse plug-in ..Link
 
5.open the eclipse.exe file and create a workspace and a project.
Select the path where you want ur project files needs to be stored.














  

6. Create a project
    File-->New--> Java project

Give the project name and  select first radio in the project layout,then click next.
Once project is created, project name will display in the left side package explorer.

Now create four packages with names "framework", "test", "lib","Conf".
right click on project, select new--> package. then enter the package name.

a) Framework package is for Baseclass and other common methods.
b) tests - It contains all tests
c) lib - It contains all library files
d) Conf - It contains configurtion file( xml file ) to execute the tests.

7. Download following jar files and copy to the "Lib" folder.
    a) testng  jar link
    b) Selenium server jar - Download RC
    c) Selenium java cleint driver - link
    d) log4j jar - link

 8. after copying above jar files in the lib folder, right click on project and click on properties.
Now, add all four files to the buildpath.
9.  right click on framework , select New--> class. give the class name as BaseTest.
   once basetest.java file created, copy code from this link.

10. right click on tests, select New--> class. give the class name as test1.
   once test1.java file created, copy code from this link
11. right click on conf, select New--> file. give the class name as AC-run.xml.
   once AC-run.xml file created, copy code from this link
12. right click on project, select New--> file. give the class name as build.xml.
   once build.xml file created, copy code from this link.

After all above steps are completed, structure should look like below.
13. Now we are good to execute tests from conf file.
     right click on AC-run.xml file and select Run as--> TestNG Suite
   14. testNG result will display as below
      
15. Html output will be stored in the "test-output" as below
   

2 comments:

  1. build.xml file is not available for download.
    It will be helpful for understanding the framework.
    without that i'm not able to run.
    Please do the needful asap. or u can mail me on srinivas.mamidla@gmail.com

    ReplyDelete
  2. 12. right click on project, select New--> file. give the class name as build.xml.
    once build.xml file created, copy code from this link.

    for the above, the "link" is not hyperlinked, itis not working, could you please update.

    Thanks,
    Sri...

    ReplyDelete