The Complete Unit Testing Collection [Tutorials and Frameworks]
This collection features the best and most popular unit testing tutorials, opinion pieces, and analysis from articles across DZone.
Join the DZone community and get the full member experience.
Join For FreeBreaking Unit Testing Down
- Introduction and History of Unit Testing [Part 1] by Leah Grantz — We all know we should be incorporating unit testing into our development processes, but do you know the history of this concept? We take a look into the history of test automation to get a look at where this all got started.
- Unit Testing Guidelines: What to Test and What Not to Test by Anton Angelov — Unit testing can often take on a rather broad connotation. We try to help narrow down the phrase in terms of what it should (and shouldn't) cover.
- Importance of Unit Testing by Bala Murugan — Unit testing is one of the simplest and first measures that developers should take to prevent bugs in production.
- The Role of Unit Tests in Test Automation by Bobby Lalvani — Because TDD and AAA complement each other so well, you should combine them with test management tools to get the best results on your DevOps test automation projects.
- Why Do We Unit Test? And What’s the Purpose of Code Coverage? by Kevin Hooke — Use code coverage as a tool to help you find untested code, not as an ultimate goal.
- 8 Benefits of Unit Testing by Ekaterina Novoseltseva — You simply can't overlook the benefits of tearing your application apart, testing each, and putting it all back together.
Writing Unit Tests
- 10 Tips to Writing Good Unit Tests by Grzegorz Ziemoński — A good test suite can make your life easier by making you feel safe when changing your code; a bad test suite can make you miserable and waste a ton of your time.
- Best Practices for Writing Unit Tests by Jonathan Danylko — Do you know when it's time to write unit tests? Today, we try to provide insight on best practices for how (and when) to write unit tests.
- Writing Your F.I.R.S.T Unit Tests by Dan Newton — First-class developers write their code test-first using FIRST. Tests should be fast, independent, repeatable, self-validating, and timely.
Unit Testing Tools Written In...
Java
- Unit Testing With Mockito by Sukumar Kuppuswamy — Learn how to write effective unit tests with the Mockito framework as part of Test-Driven Development.
- Unit Testing With Apache Camel by Jitendra Bafna — Learn how to write unit test cases for Camel routes while taking advantage of its Java library and camel-test module to test your routes and integrations.
- How to Write Great Unit Tests With JUnit: Major Features of JUnit 4 by Dilini Rajapaksha — This tutorial teaches the essentials of writing readable, maintainable unit tests in JUnit, covering the four main features with examples of each.
- Intro to Unit Testing in Java With JUnit5 Library by Yuri Mednikov — Check out this post to learn more about Java unit testing with JUnit 5.
JavaScript
- Unit Testing in Angular 4 Using Jasmine and Karma - Part 1 by Debasis Saha — Learn about the logistics and necessity of unit testing and learn how Jasmine and Karma work together to accomplish this in Angular 4 applications.
- Unit Testing in Angular 4 Using Jasmine and Karma - Part 2 by Debasis Saha — Learn how to develop unit tests for Angular 4 components, directives, and services in part 2 of this tutorial series.
- Unit Testing With JS Promise by Venkatraman Ramamoorthy — Learn about executing unit testing for JavaScript with JS Promise, which can help you work with asynchronous operations more smoothly.
- Unit Testing Self-Invoking JavaScript Functions by Bendix Saeltz — Using QUnit and Sinon.js achieves the possibility of unit testing — and using the Google closure compiler with hard optimization enabled minifies code efficiently.
.NET Core and .NET
- How to Write Unit Tests for a .NET Core Application by Dhananjay Kumar — In this post, we take a look at how to create effective unit tests in a .NET Core application. This tutorial will help you learn by doing.
- Unit Testing With .NET Core by Jeremy Morgan — This tutorial will show .NET Core developers how to easily build and perform unit testing on this mature framework.
C, C++, and C#
- Unit Testing With C++: The How and the Why by Eric Goebelbecker — Learn the inner workings of unit testing with C++ and why it's so important.
- Unit Testing With Entity Framework and Entity Framework Core 2.1 by Paul Michaels — Learn how to write unit tests for data access for use with the In-Memory Database setting in Entity Framework Core 2.1.
- Most Complete NUnit Unit Testing Framework Cheat Sheet by Anton Angelov — This ''cheat sheet'' will help you get started with NUnit for unit testing .NET applications by getting familiar with its syntax.
Unit Testing Best and Worst Practices
Patterns and Anti-Patterns
- The Deadly Sins of Unit Testing — Part 1 by Erik Dietrich — These seven habits make for bad unit testing. Make sure you're not falling into these traps.
- The Deadly Sins of Unit Testing — Part 2 by Leah Grantz — Sloth, envy, and lust...learn how to spot and avoid slow dependencies, greedy algorithms, and inappropriate intimacy code smells to improve your unit tests.
- The Anatomy of Good Unit Testing by Jason Fauchelle — Here is a collection of thoughts and tid-bits that the author finds useful when writing tests (with examples in C#).
- Unit Testing: The Good, Bad, and Ugly by Ayush Prashar — We may not enjoy unit testing, but it's essential to software quality. Let's explore the importance and workings of unit testing.
- Unit Testing Anti-Patterns — Full List by Yegor Bugayenko — Let's take a look at anti-patterns to avoid when it comes to unit testing.
Some Words of Advice
- Handling Noisy Unit Test Suites by Arthur Hicken — Learn automation strategies to clean up your test suite of unit tests that fail, but have never been fixed for one reason or another.
- Java Unit Testing Best Practices: How to Get the Most Out of Your Test Automation by Brian McGlauflin — Following these best practices can make unit testing a quick and easy way to verify that your software is functional.
- Single-Statement Unit Tests by Yegor Bugayenko — The biggest benefit of this principle is that tests become declarative and object-oriented instead of being algorithmic, imperative, and procedural.
- Unit Testing: Indispensable by Rajesh Raj — Skipping unit testing can be dangerous. See why and learn how to start integrating it into your DevOps development process.
- Avoiding Common Hurdles in Unit Testing by William Riley-Land — Take a look at these tips for better mocking, mocking modules, code coverage, error handling, and more.
Implementation: Putting Unit Testing to the Test
The Business Case for Unit Testing
- The Business Case for Unit Testing — Part 1 by Erik Dietrich — Want to learn more about the importance of unit testing for businesses and dev teams? Check out this post to learn more about the necessity of unit testing.
- The Business Case for Unit Testing — Part 2 by Erik Dietrich — Learn more reasons that unit testing isn't just good for developers or testers — it's good for the business as a whole.
- Implementing Unit Testing: Goals by Gil Zilberfeld — This series talks about creating a sound unit testing strategy; the first thing to think about it your goals. Read on for some pointers.
- Implementing Unit Testing: Outcomes by Gil Zilberfeld — It's good to have goals, but this chapter in the series talks about outcomes- how to know that you're on track to achieve those goals.
Unit Testing ♥s DevOps
- CI/CD Pipelines to Run Unit Testing in Docker [Video] by Mohamed Radwan — This video demonstrates how to run unit tests within a Docker container and explains some of the intricacies of a Dockerfile.
- How Does Unit Testing Fit Into the DevOps World? by Erik Dietrich — See how unit tests form an important part of a DevOps process when you apply test automation to operations and deployment.
- Unit Testing and DevOps by Arthur Freyman — Unit tests are arguably mandatory. Get a comprehensive overview of libraries, tools, and strategies for DevOps unit testing.
- Go With Flow: Unit Testing, DevOps, and the Mainframe by Jason Bloomberg — Here are some insights into where Agile, DevOps, and some of their associated approaches like Flow Agile and CI/CD combine for better synergy.
- Unit Testing and Test Automation: Two Things You're Not Doing Enough Of by Erik Dietrich and RJ Williams — Unit testing, testing automation, quality assurance: all things work together for the good of your software. And your Scrum Master's mental health.
For the Devs
- Living in a ‘More Data, More Problems’ World With Unit Tests by Glenn Everitt — Unit testing in a world of increased data can become a bit unwieldy. Take a look at what that means and how your automated testing can cope with this reality.
- Improving C# Code Using Refactoring and Unit Testing by Ngoc Minh Tran — If you're hoping to improve your code quality, learn to use several refactoring and unit testing methods to turn bad code into beautiful code with these steps.
Unit Testing Questions and Considerations
- Unit Testing: The Myth of Complete Isolation by Grzegorz Ziemoński — The notion that unit tests should be performed in complete isolation is a myth. We should use isolation to our advantage, wherever it makes our tests more manageable.
- How Much Unit Testing Is Enough? by Erik Dietrich and RJ Williams — Teams want the benefits of unit testing while losing as little precious time to it as possible. How can we find that delicate balance?
- Why Do Programmers Fail to Write Good Unit Tests? by Leah Grantz — There is debate about what makes a good unit test. Since no one's perfect, here's how to make a good unit test, and more about why you should bother.
- Why Your Team Needs to Start Unit Testing Right Now by Eli Lopian — You have a well-established, experienced team. So why look for issues? Read on to find out why unit testing is still important!
- Why Do You Need to Unit Test If You Have a QA Team? by Erik Dietrich — This introduction to the need for unit testing shows the difference between unit testing and QA, and why you need people dedicated to both.
- The Five Stages to Unit Testing Enlightenment by Said Aspen — Namaste.
- To Unit Test or Not to Unit Test? by Alfredo Pinto — Get some insight on the importance of unit tests and well-organized software architecture.
- Unit Testing vs. Integration Testing: What's the Difference? by Leah Grantz — Let's help clarify the differences between unit testing and integration testing and look at what each of them means and how they come together.
Related Collections
unit test
.NET
Framework
Entity Framework
Database
Test automation
scrum
agile
DevOps
Opinions expressed by DZone contributors are their own.
Comments