• Menu
  • Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

JavaBeat

Java Tutorial Blog

  • Java
    • Java 7
    • Java 8
    • Java EE
    • Servlets
  • Spring Framework
    • Spring Tutorials
    • Spring 4 Tutorials
    • Spring Boot
  • JSF Tutorials
  • Most Popular
    • Binary Search Tree Traversal
    • Spring Batch Tutorial
    • AngularJS + Spring MVC
    • Spring Data JPA Tutorial
    • Packaging and Deploying Node.js
  • About Us
    • Join Us (JBC)
  • Java
    • Java 7
    • Java 8
    • Java EE
    • Servlets
  • Spring Framework
    • Spring Tutorials
    • Spring 4 Tutorials
    • Spring Boot
  • JSF Tutorials
  • Most Popular
    • Binary Search Tree Traversal
    • Spring Batch Tutorial
    • AngularJS + Spring MVC
    • Spring Data JPA Tutorial
    • Packaging and Deploying Node.js
  • About Us
    • Join Us (JBC)

Spring Test MVC HtmlUnit 1.0.0.M1 Release

March 18, 2014 //  by Krishna Srinivasan//  Leave a Comment

HTmlUnit is the GUI-less browser for Java programs to simulate the browser functionality. This tool is primarily used for testing the web applications for simulating the browsers. This tool is not intended for using it as stand alone project, it has to be used as part of the another testing framework like JUnit or TestNG. This tool itself used as the underlying browser for many of the UI testing frameworks like Canoo WebTest, JWebUnit, WebDriver, JSFUnit, WETATOR, Celerity, etc.

Spring IO has its own testing framework Spring Test MVC. This framework could test the controllers and injected wores. However, testing the HTML views could be challenging for the normal testing framework unless it has its own UI testing framework. Spring Test MVC announced its Spring Test MVC HtmlUnit 1.0.0.M1. With this, it will be easy to test the HTML views in the spring applications.

Read : Spring Test MVC Framework

Spring Test MVC and HtmlUnit eases testing of HTML based views by providing:

  • Support for testing with JavaScript in the HTML views
  • Integration with HtmlUnit
  • Integration with WebDriver via HtmlUnitWebDriver For an example see MockMvcCreateMessageTest
  • Geb Spock integration For an example see CreateMessagesISpec
  • Easily mocking services for fast & thorough testing on views and controllers. For example, you can quickly and easily test behavior when no results should be produced, one page of results, two pages of results, etc.

Maven Configuration for Spring Test MVC and HtmlUnit Integration

<repository>
       <id>spring-milestone</id>
       <url>https://repo.spring.io/milestone</url>
</repository>

<dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-test-mvc-htmlunit</artifactId>
       <version>1.0.0.M1</version>
       <scope>test</scope>
</dependency>

<dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-test-mvc-htmlunit</artifactId>
       <version>1.0.0.BUILD-SNAPSHOT</version>
       <scope>test</scope>
</dependency>

You can refer more details in the official website.

Category: Spring FrameworkTag: HtmlUnit, Spring Test MVC

About Krishna Srinivasan

He is Founder and Chief Editor of JavaBeat. He has more than 8+ years of experience on developing Web applications. He writes about Spring, DOJO, JSF, Hibernate and many other emerging technologies in this blog.

Previous Post: « HTML5 Small Tag
Next Post: HTML5 Placeholder Attribute »

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Follow Us

  • Facebook
  • Pinterest

FEATURED TUTORIALS

New Features in Spring Boot 1.4

Difference Between @RequestParam and @PathVariable in Spring MVC

What is new in Java 6.0 Collections API?

The Java 6.0 Compiler API

Introductiion to Jakarta Struts

What’s new in Struts 2.0? – Struts 2.0 Framework

JavaBeat

Copyright © by JavaBeat · All rights reserved
Privacy Policy | Contact