Java Software Testing tutorials: unit testing, open source, JUnit, Mockito, TestNG, Spring, JGiven, etc.
This tutorial looks at what Cucumber is good for Behavior-Driven development (BDD) with Java — and what it isn’t. It briefly covers what BDD is and how the open source tool Cucumber helps deliver on the promise of improved communication between the business and the development team.
Mockito is a popular open source mocking framework for Java code. In this article, Marcin Grzejszczak explains how you can use Mockito by adding it to different paths. You will also learn how to implement new tests by using Mockito hints and warnings.
This presentation pulls a variety of examples in testable development from the speaker book “Continuous Enterprise Development in Java” published by O’Reilly. It includes a review of the sections on RESTful services, UI verification, transactions and security.
Two years ago, we introduced Spock tests into the MongoDB Java driver. The decision could be considered controversial – the project used no external dependencies in production code, and was 100% Java. But there was a back door… with Gradle as the build system, there was a tiny excuse to use Groovy in the project, provided it was not in the production code. That was all the excuse we needed to start using Spock for unit and later, integration tests.
Tomek Kaczanowski writes that the idea behind its “Bad Tests, Good Tests” book is “to present test code snippets and discuss ways of making them better.” To achieve this goal, he explores a large amount of code and tests to discuss all the issues that you can meet in your software testing activities.
Concurrency has become an increasingly important topic in the Java space. Nevertheless, most Java developers do not address concurrency in their unit tests. This talk shows how to and how not to test concurrent code and introduces Thread Weaver, a library for testing concurrent code.
Is it possible to decrease the turn-around time of your test suite for applications built using the Spring framework for Java? How can you make sure that your tests execute independently? Is it possible to automatically verify that the database schema is kept in sync with the source code? What are the trade-offs?