Unit Testing

A collection of 45 posts
Using JKI VI Tester

Using JKI VI Tester

If you have been following my posts, you will know that I am a big fan of JKI VITester. It is my goto Unit Tester. Why? Mostly because it is an implementation of xUnitStyle testing, which means that I can easily use all of the great patterns outlined in xUnit
5 min read
Reusing Tests for Built Code

Reusing Tests for Built Code

As I have been doing more and more Unit Testing and Continuous Integration, I have often wondered about automating testing of built code. There are promising tools out there for testing built Win32 apps, such as WinAppDriver. There is also Selenium for testing webapps, so if you are into the
2 min read
Mock Objects Advanced Features

Mock Objects Advanced Features

In the last post, I talked about how to use Mock Objects in Unit Tests. In this post, I am going to talk about some advanced features of the Mock Objects. It is worth going back and reading my previous posts on Mock Objects if you have not already done
4 min read
How To Use Mock Objects in Tests

How To Use Mock Objects in Tests

In the last couple posts, I talked about Mock Objects: what they are and how to implement them in LabVIEW. In this post, I am going to talk about how to use them in unit tests. For reference, the video below shows how to use the Class Refactoring Toolkit and
3 min read
Anatomy of a Mock Object

Anatomy of a Mock Object

In the last post, I talked about Mock Objects and what they are. In this post, I am going to talk a little bit about what they look like when you implement them in LabVIEW. The video below shows how to use the Class Refactoring Toolkit I created to create
3 min read

October 2019 Webinar

Test Driven Development October 23 11:00am MT I Tried Unit Testing But Testing My Existing Code Is Too Hard! That’s because you have got the order wrong! Writing unit tests after the fact is possible, but it is always hard. Why? Because whoever wrote it never thought about
2 min read

Creating Mocks in LabVIEW

In my last article, I introduced the concept of Mock Objects. The obvious next question is how do you implement them in LabVIEW? Many other languages either have builtin or readily available third party mock objects frameworks. LabVIEW does not. Until Now. I’ve create some tools for class refactoring
2 min read
Mock Objects

Mock Objects

At the upcoming CLA Summit, I will be giving a presentation on mock objects. I thought I would introduce them here first for those who aren’t familiar with them. If you read any literature on unit testing you are bound to run into them. A Different Kind of Test
2 min read

LightWeight Doubles with SQLite

In a previous article, I mentioned that one reason to use a Test Double was to increase performance. One place where this is evident is in database access. Doubles can be very useful for database operations for the following reasons: * Isolation from the production database – Isolate any changes you make
2 min read
Test Doubles In Action

Test Doubles In Action

In the last post, I talked about Test Doubles and some various types that we can use and how to implement them. The next obvious question is how do we actually use them in our tests. Dependency Injection Understanding Test Doubles first requires understanding the concept of dependency injection. This
2 min read
Intro to Test Doubles

Intro to Test Doubles

It’s no secret that many Hollywood actors use stunt doubles. These are specialists that from the outside look and behave like the stars, but have unique talents. The actors do most of the heavy lifting in terms of acting, but for fight scenes, car chases, jumping off buildings, etc.
3 min read
Humble Objects

Humble Objects

Ego is the Enemy. Ego can cause us all kinds of problems in our personal and professional lives. When it comes to software, it is no different. Objects and VIs that have large egos create problems. One of the problems they cause is that they make it very hard for
2 min read
Unit Testing As An Aid For API Development

Unit Testing As An Aid For API Development

If you follow Test Driven Development (TDD) the first step is always to write your unit tests before you write your code. Well in LabVIEW that doesn’t work out quite so well because you need to have a subvi to drop into your test case. That means that before
1 min read
Unit Testing as Bug Repellant

Unit Testing as Bug Repellant

Nobody likes bugs, whether they are mosquitoes, black flies, spiders, or software bugs. One mosquito bite is generally mildly annoying but tolerable. Similarly with software, if your customers find a bug, it usually results in mild annoyance. Of course, there are exceptions to both: some mosquito bites can be deadly
2 min read
Unit Testing as a Delegation Tool

Unit Testing as a Delegation Tool

Delegation is hard. There are a variety of reasons, but there are two things I’ve heard quite often from customers, and they are related. They have trouble specifying and clearly communicating the exact requirements to the person they are delegating to. They also have trouble verifying that whatever code
2 min read
Unit Testing as Documentation

Unit Testing as Documentation

Comments and documentation often lie. The only truth is the code. Steve Watts commenting on Chris Stryker’s Clean Code presentation at NIWeek 2019 Now I don’t think Steve is accusing the developer who wrote the code or documentation of deliberately lying, but we’ve probably all encountered code
2 min read
Unit Testing as a Safety Net

Unit Testing as a Safety Net

Since I recently finished reading xUnit Test Patterns and my upcoming webinar is on Unit Testing, I have been thinking a lot about it lately. I thought I would expand on some of the ways in which I find unit testing incredibly useful. Most of wouldn’t even think of
2 min read
XUnit Test Patterns

XUnit Test Patterns

If you want to know everything there is to know about xUnit Testing, then xUnit Test Patterns by Gerard Meszaros is the book for you. I must warn you, it is not light reading (it’s almost 900 pages) and it is not geared towards beginners. You should at least
2 min read

Six Easy Ways To Earn Technical Interest

Steve Watts recently made a excellent blogpost about Technical Accounting. If you don’t follow Steve’s blog you definitely should. In this particular article, he coined the terms Technical Debt, Technical Investments, Technical Assets, and Technical Tax. Steve’s talk of Technical Investments, got me thinking about Technical Interest.
4 min read