Home » Tag Archives: Testing (page 23)

Tag Archives: Testing

Extending JMeter with a WS-Trust/STS sampler

apache-jmeter-logo

JMeter does not have any inbuilt support for WS-Security or WS-Trust and that made me develop this STS Sampler for JMeter – which could make anyone’s life better while load testing an STS. First you need to have the Apache JMeter distribution. I am using v2.7. Then you can download sts.sampler.zip from here – unzip it and copy the “repo” ...

Read More »

Extending JMeter with a password digest generator

apache-jmeter-logo

Recently I had to work on loading an OpenLDAP instance with 50,000 user records and carry on some stress testing. JMeter was the best choice to populate the LDAP. But.. in my case, OpenLDAP was configured not to accept any clear text passwords. So, I could not login in with any of the random generated passwords I added via JMeter ...

Read More »

Integration tests with Maven 3, Failsafe and Cargo plugin

codehaus-cargo-logo

Unit testing is available in Maven out of the box. Because of that very often its used for integration tests as well. Major disadvantage of this is that integration tests can take much more time to execute and because no one likes to wait long time every build – tests are just skipped with -Dmaven.test.skip=true flag In order to execute ...

Read More »

Categorize tests to reduce build time

apache-maven-logo

Before we progress with the main content of the article, let’s get a few definitions out of the way. Unit tests Unit tests are tests that are small (tests one use case or unit), run in memory (do not interact with database, message queues etc.), repeatable and fast. For our conversation let us restrict these to JUnit based test cases ...

Read More »

Tomcat Context JUnit @Rule

junit-logo

A first draft of a JUnit @Rule that create the test context. This can be used with the Spring context rule for this post to create a complete Spring context for integration tests. import org.apache.commons.dbcp.BasicDataSource; import org.apache.log4j.Logger; import org.junit.rules.TestRule; import org.junit.runner.Description; import org.junit.runners.model.Statement; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; import javax.sql.DataSource; import javax.xml.parsers.DocumentBuilder; import ...

Read More »

Spring MVC Integration Tests

spring-interview-questions-answers

An approach to Integration Testing the controllers in Spring MVC is to use the Integration Test support provided by Spring. With Junit4 this support consists of a custom Junit Runner called the SpringJunit4ClassRunner, and a custom annotation to load up the relevant Spring configuration. A sample Integration test would be along these lines: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations={"classpath:/META-INF/spring/webmvc-config.xml", "contextcontrollertest.xml"}) public class ContextControllerTest { ...

Read More »

EasyMock tutorial – Getting Started

easymock-logo

In this post, I’m going to show you what EasyMock is and how you can use it for testing your java application. For this purpose, I’m going to create a simple Portfolio application and test it using JUnit & EasyMock libraries. Before we begin, lets first understand the need behind using EasyMock. Lets say, you are building an Android mobile ...

Read More »

Testing legacy code: Hard-wired dependencies

software-development-2-logo

When pairing with some developers, I’ve noticed that one of the reasons they are not unit testing existing code is because, quite often, they don’t know how to overcome certain problems. The most common one is related to hard-wired dependencies – Singletons and static calls. Let’s look at this piece of code: public List<Trip> getTripsByUser(User user) throws UserNotLoggedInException { List<Trip> ...

Read More »

Test-driving Builders with Mockito and Hamcrest

mockito-logo

A lot of people asked me in the past if I test getters and setters (properties, attributes, etc). They also asked me if I test my builders. The answer, in my case is it depends. When working with legacy code, I wouldn’t bother to test data structures, that means, objects with just getters and setters, maps, lists, etc. One of ...

Read More »
Want to take your Java Skills to the next level?
Grab our programming books for FREE!
  • Save time by leveraging our field-tested solutions to common problems.
  • The books cover a wide range of topics, from JPA and JUnit, to JMeter and Android.
  • Each book comes as a standalone guide (with source code provided), so that you use it as reference.
Last Step ...

Where should we send the free eBooks?

Good Work!
To download the books, please verify your email address by following the instructions found on the email we just sent you.