Thursday, 26 March 2015

First Test Case with Selenium

Write your First Test Case

Prerequisites for writing Test Case in Eclipse using Selenium  Webdriver are Download and Install Java,Download and Start EclipseDownload Webdriver Java Client and Configure Eclipse with Selenium Webdriver. Once you are done with this you need to create a new Project PackageClass and adding External Jars  to your newly created project.
Now you are all set to write your first test script. I have set up a Dummy Online Store to practice automation. So, let’s launch the website, sign In using test login credential and log out.
1) Copy & paste the below code to your First Test Case class and give it a run.

2) Now, to start the test just select Run > Run As > Java Application Or Right Click on Eclipse code and ClickRun As  > Java Application

3) After a few Seconds a Mozilla browser will open  and you will see that with the help of your script, Selenium will Launch the Online Store, perform Sign in, display the Message, perform Log out and thenClose the browser.
Once the execution is finished, you will see the message in Console section of the Eclipse IDE.
Eclipse-Output-2

No comments:

Post a Comment