Home » Tag Archives: Testing (page 3)

Tag Archives: Testing

Separating Integration Tests from Unit Tests Using Maven Failsafe & JUnit @Category

apache-maven-logo

Why Unit Tests Should Run Separately From Integration Tests TDD at the Unit Testing level is fairly straight-forward, since classes in unit testing either do not have complex dependencies, or you mock-out the dependencies with a mocking framework (ex. Mockito). However, TDD quickly becomes difficult when we get to Integration Testing. Integration Testing is basically testing a component with some or all ...

Read More »

Given When Then in Java

junit-logo

tl;dr you can use labels to clarify a given-when-then style of testing. What is given-when-then? given-when-then is a commonly used style of specifying system behaviour in which your tests are split into three sections. Given is the section that lays out the pre-conditions for the test, ie whatever state you’re assuming the world to be in before you start. The ...

Read More »

Advanced Creation of Hamcrest Matchers

hamcrest-logo

Intro Last time, I went over what a Hamcrest Matcher was, how it’s used, and how to make one. In this article, I will explain more advanced steps in the creation of Hamcrest Matchers. First, I’ll share how to make your matchers more easily type-safe, then some techniques for stateless Matchers, then finally how to cut down on so many ...

Read More »

Redesigning Hamcrest

hamcrest-logo

I’ve done a few posts on the Hamcrest library, and I really do enjoy using it, but there are a few changes I would love to make to it. I understand most of the design decisions that they made, but I think some of them weren’t really worth it. Introducing Litecrest Most of the changes I would make to the ...

Read More »

Testing with files and directories in JUnit with @Rule

junit-logo

Testing with Files and directories in JUnit is easy thanks to TemporaryFolder @Rule. In JUnit rules (@Rule) can be used as an alternative or an addition to fixture setup and cleanup methods (org.junit.Before, org.junit.After, org.junit.BeforeClass, and org.junit.AfterClass), but they are more powerful, and can be more easily shared between projects and classes. The code to be tested   public void ...

Read More »

Book Review: Mockito Essentials

mockito-logo

The subtitle of Sujoy Acharya‘s Mockito Essentials (Packt Publishing, October 2014) is: “A practical guide to get you up and running with unit testing using Mockito.” The Preface and seven chapters in Mockito Essentials span approximately 190 substantive pages. Preface In the Preface, author Sujoy Acharya writes that Mockito Essentials “is an advanced-level guide that will help software developers to ...

Read More »

How to perform client side web performance testing in JMeter?

apache-jmeter-logo

In this article we will see how can we do client side performance testing using Jmeter Plugins. I will be using jmeter webdriver plugins. Before starting this topic, please have some basic information on client side performance testing from my previous post. So, lets get started:         Installation Install Jmeter and Plug ins from below links following ...

Read More »

Testing JVM server-side JavaScript with Jasmine, Spock and Nashorn

java-logo

JavaScript usage is not limited to client-side code in browser or NodeJS powered server-side code. Many JVM based projects are using it as internal scripting language. Testing this sort of functionality is neither straightforward nor standard. In this post I intend to demonstrate an approach for testing JavaScript in server-side JVM environment using mature tools like Jasmine, Spock and Nashorn. ...

Read More »

Why do we mock?

software-development-2-logo

I do Java interviews. During the interviews I ask technical question that I know the answer for. You may think this is boring. To be honest: sometimes it is. But sometimes it is interesting to learn what misconcepts there are. I happened to ask during the interview what you can read in the title: “Why do we mock?”. The answer ...

Read More »

Checking Sanity in TDD Testing

software-development-2-logo

Whether you’re in the process of fully adopting Test Driven Development (TDD), providing unit tests after you have written your code, or something in between, the question that you will soon ask is: “What should I be testing?” The simplest answer to me is: any place where you can isolate and test just your code. In my opinion, Test-Driven Development ...

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.