Create a Web application using spring and testing it using selenium web driver

/
0 Comments
Spring can be used for pass objects through server to web page. In this article I am going to implement a HTML form as a data source. A java class can be created as a POJO(Plain Over Java Object) for assign the details of the input source. Form details can be assigned to a object and it can be passed to the another HTML page.

For the above task I used

1. Intellij idea
2. Java JDK 1.8
3. Maven 3.0

This Video will guide you how to create a simple application using spring MVC. Then you can gain some brief idea about how spring MVC works.

Here is the implementation for complete the above task.You can clone it or download it. You have to use a tomcat,glassfish or any other container for run this. Code included two main classes. greetMsgMoel class is act as a model and HelloControler  class is act as a controller. If you go through the implementation you can gain some idea about what's happening there. Both Home and simpleForm jsp files are handled by the controller. When you run the program it will scan the input and after you submit it the text you typed will display in another page.

I have used selenium web driver for testing.

" WebDriver is a tool for automating web application testing, and in particular to verify that they work as expected. It aims to provide a friendly API that's easy to explore and understand, easier to use than the Selenium-RC (1.0) API, which will help to make your tests easier to read and maintain."

This is what wiki says about WebDriver.
For further details here is the documentation of the selenium web driver.
http://www.seleniumhq.org/docs/03_webdriver.jsp

Here is the implementation for the above task. You can clone it or download it. First you need to run the spring application  which you have to test. Then you can add the localhost url to the testing implementation for testing. After that you have to run the testing implementation and it will open the firefox window and automatically go to the url of the web application. In the testing implementation I have added some test cases. So program will submit those test cases to the text box and then it will test if the submitted text is equal to the passed text.
If you need to gain some knowledge about spring MVC and selenium webDriver I hope this article can be useful to you.



You may also like

No comments :

Powered by Blogger.