chapter four

4 Testing web applications

 

This chapter covers

  • Testing Spring web applications with MockMvcTester and alternatives
  • Running the full web server in tests
  • Simulating browser interactions with HtmlUnit
  • Driving a complete web browser in tests with Selenium

4.1 Testing WebMvc applications with MockMvcTester

4.2 Alternatives to MockMvcTester

4.2.1 MockMvc, the original component

4.2.2 WebTestClient for WebFlux-based applications

4.2.3 Other alternatives

4.3 Running the full web server in tests

4.4 Simulating human interaction with HtmlUnit

4.5 Testing through a real web browser with Selenium

4.5.1 Configuring Selenium

4.5.2 Writing Selenium tests

4.6 Summary