Home » Tag Archives: Testing (page 20)

Tag Archives: Testing

Spring MVC Customized User Login Logout Implementation Example

spring-security-logo

This post describes how to implement a customized user access to an Spring MVC web application (login logout). As a prerequisite, readers are advised to read this post which introduces several Spring Security concepts. The code example is available from Github in the Spring-MVC-Login-Logout directory. It is derived from the Spring MVC with annotations example. Customized Authentication Provider In order ...

Read More »

JUnit Testing Spring Service and DAO (with In-Memory Database)

spring-interview-questions-answers

This post describes how to implement JUnit tests for a Spring Web Application’s Services and DAO. It is built on top of the Spring MVC-Service-DAO-Persistence Architecture Example. This example is available from Github in the Spring-Web-JPA-Testing directory. Reminder Test Fixture – The fixed state used as a baseline for running tests. Unit test – These tests verify that pieces of ...

Read More »

Spring MVC Controller JUnit Testing

spring-interview-questions-answers

JUnit testing Spring MVC controllers is not an easy task. But recently, a new project (to be included in Spring soon) offers new tools to facilitate this. This post illustrates how to test a simple controller via JUnit tests. This code is a variation of the code used in JUnit Testing Spring Service and DAO (with In-Memory Database). It is ...

Read More »

Opinion: Performance Testing

software-development-2-logo

Performance tuning an application is time consuming, and expensive. Useful tests often need dedicated hardware to run on. It’s specialised and time consuming to prepare the ground work and write the various fixtures needed to run, and whose only perceived benefit is preventing a production issue that you don’t even know will happen yet. Stereotypical Scenarios and Outcomes Here’s some ...

Read More »

Enhancing Spring Test Framework with beforeClass and afterClass setup

spring-interview-questions-answers

How to allow instance methods to run as JUnit BeforeClass behavior JUnit allows you to setup methods on the class level once before and after all tests methods invocation. However, by design on purpose that they restrict this to only static methods using @BeforeClass and @AfterClass annotations. For example this simple demo shows the typical Junit setup: package deng.junitdemo; import ...

Read More »

Testing Custom Exceptions with JUnit’s ExpectedException and @Rule

junit-logo

Exception Testing Why test exception flows? Just like with all of your code, test coverage writes a contract between your code and the business functionality that the code is supposed to produce leaving you with a living documentation of the code along with the added ability to stress the functionality early and often. I won’t go into the many benefits ...

Read More »

JUnit Pass Test Case on Failures

junit-logo

Why create a mechanism to expect a test failure? There comes a time when one would want and expect a JUnit @Test case fail. Though this is pretty rare, it happens. I had the need to detect when a JUnit Test fails and then, if expected, to pass instead of fail. The specific case was that I was testing a ...

Read More »

Test Driven Traps, part 2

junit-logo

The Story of a Unit in Unit Tests In the previous part of this article, you could see some bad, though popular, test samples. But I’m not a professional critic (also known as a troll, or a hater), to grumble about without having anything constructive to say. Years of TDD have taught me more than just how bad the things ...

Read More »

Test Driven Traps, part 1

grails-logo

Have you ever been in a situation, where a simple change of code, broke a few hundred tests? Have you ever had the idea that tests slow you down, inhibit your creativity, make you afraid to change the code. If you had, it means you’ve entered the Dungeon-of-very-bad-tests, the world of things that should not be. I’ve been there. I’ve ...

Read More »

The crystal ball illusion

java-interview-questions-answers

I have noticed that people sometimes avoid doing thorough testing. This may sound as bogus to some, but hear me out… I do understand why this happen. Tests can create a feeling of being trapped, a burden that gets heavier to carry with every new test introduced. Building a stable, non-intrusive and quality ensuring suite of tests is a difficult ...

Read More »
Do you want to know how to develop your skillset and become a ...

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!
Get ready to Rock!
To download the books, please verify your email address by following the instructions found on the email we just sent you.

THANK YOU!

Close