Content tagged with: java
Mockito is an open source mock framework for Java that letsyou write beautiful tests with clean and simple API. This video shows how to verify mock objects using Mockito.
The open source JUnit unit testing tool has been a blessing for Java developers. However, many programmers think that it is enough to learn the JUnit API and write a few tests in order to have a well-tested application. This idea is more dangerous than not doing unit tests because it leads to a wrong sense of code quality. Learning JUnit is the easiest part of unit testing your Java code, but writing good tests is the hard part.
Issues with testability boil down to our inability to write tests or the excess trouble we have to go through to get it done. In this article, based on chapter 7 of Unit Testing in Java, author Lasse Koskela shares a set of dos and don’ts for testable design. In the tips provided, he recommends to avoid complex private methods, static methods, logic in constructors and to favor composition over inheritance.
Cucumber-JVM is a pure Java implementation of Cucumber, a software testing tool that support Behavior Driven Development with plain text specifications and unobtrusive automation in Ruby. Cucumber-JVM supports Clojure, Groovy, Java, JavaScript (Rhino interpreter), Python (Jython interpreter), Ruby (JRuby interpreter) and Scala. It is now written in a native Java-API, which compiles down to fast JVM bytecode. It enables many JVM capabilities and makes it even easier to integrate with your Java applications. Note from the Editor: we had the regret to realize after publication that there is no sound …
The testing strategy to adopt when you you run your code inside a Java EE container is the topic discussed in this blog post by Antonio Goncalves. To solve this issue, he presents a detailed step by step process to unit test an EJB with Mockito and how to do integration test with and without Arquillian with code samples. His conclusion is that since Java EE 6 it is now easy to use container and services in an embedded mode. Unit testing is good to test business code or code …
In the context of Java unit testing, a sleeping snail is a test that’s sluggish and takes (relatively speaking) forever to run because it relies on Thread#sleep and arbitrarily long waits to allow threads to execute before performing assertions or continuing with the workflow under test. In this article, based on chapter 5 of Unit Testing in Java, author Lasse Koskela explains this code smell and the appropriate deodorant with an example
This presentation addresses the missing link in Enterprise Java development: simple, easy integration testing. You will learn how the simplified component model of Java EE can be applied to testable development.
Mockito is an open source mocking framework for Java. In this series of blog posts, Holger Staudacher shares his experiences with Mockito. He defines “effective” as arriving at clean test and production code as fast as possible. The first post of Effective Mockito explains how to setup Mockito in the Eclipse IDE for the daily work. The second post focuses on Mockito’s @Mock Annotation.
Thucydides is an open source tool that lets you use WebDriver-based unit or Behavior Driven Development (BDD) tests to write more flexible and more reusable WebDriver-based tests, and also to generate documentation about your acceptance tests. In this blog post, John Ferguson Smart explains how you can use Spring dependencies in your acceptance tests with Thucydides if you need to run your acceptance tests against an embedded web server.
Integration tests are performed after a successful execution of unit tests. Integration tests are, therefore, executed less frequently, because unit tests will naturally fail often. With this strict separation between unit tests and integration tests, we can save several minutes (sometimes, hours) with each turnaround. This article explains how integration testing can increase your productivity and ensure the deployability of your Java EE 6 application.

Twitter
Facebook
RSS Feed