Unit Testing Workshop
Corona Virus Update
Due to the corona virus, this class will be offered over Zoom. It will consist of 4 half-day sessions. This provides the added benefit of giving students more time to absorb the material and the ability to practice with the material in between sessions so they can ask better questions.
Next Workshop Aug 17,18,20,19 1pm-5pm, MT
As LabVIEW programmers, most of us are familiar with test and measurement applications. We often end up testing the individual parts that go on to make up larger systems. We test them on their own in isolation. Unit testing is the idea of taking this same approach and applying it to testing our software. Unit Testing is about breaking down our software into units and testing each unit independently.
About The Workshop
This Zoom-based workshop is spread over 4 half-day sessions. It begins with the why of unit testing and its benefits and quickly gets into the how. We’ll learn about all the available tools. We’ll also learn about the benefits of writing the tests first. We’ll dive into techniques to deal with difficult to test code. Lastly we will talk about how to apply unit testing to popular frameworks like the DQMH and the AF. By the end of the class we’ll be comfortable writing and running unit tests for all kinds of LabVIEW code, even code that may initially seem hard to test.
Who is this for?
This seminar is for anyone who writes code in LabVIEW. We can all benefit from unit testing. It can help us write more reliable and maintainable code. If you have never heard of unit testing, there is no better time to start. If you have heard of unit testing and maybe tried it, but struggled or got discouraged, this seminar will provide some new insight into what makes a good test and how to write maintainable tests. If you already have a bunch of tests, this seminar will teach you how to maintain them, keep them organized, and how to run tehm programmatically.
The workshop is broken into several lessons. The first set of lessons addresses tho basics of unit testing. The second set of modules covers techniques for hard to test code and how to integrate Unit Testing with Continuous Integration. This is the current outline. Every time we teach workshop we learn something new, so we are constantly tweaking it.
Lesson 1 – What is Unit Testing
- Background Information – What is Unit Testing? What is a unit?
- What Makes a Good Unit Test? – What are the key characteristics that we are looking for in a unit test?
- Other Types Of Testing – How is unit testing unique from other types of testing you may already be using? What is the difference between a Unit Test and an Integration Test?
- Benefits Of Unit Testing – What unique benefits do we get from Unit Testing?
Lesson 2 – Getting Started With JKI VI Tester
- Unit Testing Solutions In LabVIEW – Explore the various Unit Testing Solutions in LabVIEW. Learn how to determine which one is best for you.
- JKI VI Tester – Learn the basics of JKI VI Tester and xUnit Testing. Learn how to create new tests and run them from the GUI.
- What To Test – Learn how to decide what code needs tested. Determine what paths need tested within the code.
- Practice – Spend some time writing simple tests using JKI VI Tester
Lesson 3 – Keeping things Maintainable
- Organizing Tests – Learn how te keep tests organized on disk and in the project so they are easy to find.
- Test Suites – Learn how and why to group tests together.
- Writing Maintainable Tests – Learn how to use test utility methods, setup, teardown, and other techniques to make your tests easier to maintain.
Lesson 4 – Humble Objects
- Hard To Test Code – Learn what makes code hard to test.
- Humble Objects – Learn how to separate logic from hard to test code.
- Practice refactoring legacy code using humble objects in order to make it testable.
Lesson 5 – OOP Design Principles
- SOLID – Learn these basic principles of OOP design and how to apply them, and how we can use them to make our code easier to test.
- Composition Over Inheritance- Understand when to use inheritance and when to use composition and the tradeoffs.
- Seams – Learn how to add seams into your program so you can change the behavior when testing. This will set us up to be able to use Test Doubles and Mock Objects.
Lesson 6 – Test Doubles and Mock Objects
- Test Doubles – Learn about the various types of test doubles such as Spies, Saboteurs, and Responders and how to use them. Learn how to create reusable programmable test doubles and single-purpose hard-coded doubles.
- Mocks – Learn how Mocks work and how they differ from test doubles. Learn how to use the Mock Object Toolkit to easily create Mocks. Learn how to create custom parameters and call logs.
- Practice using both test doubles and mocks.
Lesson 7 – Practical Examples: DQMH, AF, and Timing
- Testing AF and DQMH code – Learn about techniques for testing AF and DQMH code including the built-in testing tools (as well as addons for AF), Humble Objects, and Asynchronous Testing.
- System Timing – Learn about why timing functions cause problems and how to use a toolkit to override the native LabVIEW Timing functions.
- Practice manipulating system timing using test doubles and mockobjects.
Lesson 8 – Calling Tests Programmatically
- Programmatically Running Tests – Learn how to run tests programmatically and how to generate reports.
- Testing Workflows – Learn how to build testing into your existing workflows for building packages, exes, and ppls using hooks.
- CI – Learn what CI is and how we can integrate tests. Investigate various workflow patterns. Learn how to programmatically run tests from the CLI.
- Practice calling tests from the CLI
Lesson 9 – TDD and Refactoring
- Test Driven Development – Learn the benefits of writing the tests first. Practice writing tests before adding functionality to a library.
- Refactoring – Learn the basics of refactoring and how tests help ensure that we don’t break anything when making changes.
- Practice using one of our katas.
About the Instructor
Sam Taggart is a LabVIEW Champion and owner of System Automation Solutions LLC. He has been using National Instruments Hardware and writing LabVIEW code for over a dozen years. He is a DQMH Trusted Advisor. He also teaches classes regularly for National Instruments. He recently gave a talk at GDevCon#2 on Test Driven Development, which you can watch here. You can read some of his thoughts on Unit Testing on his blog here. You can also connect with him on Linkedin or Twitter.
Sam has deep knowledge on the subject of unit testing and how it can be applied to existing and future projects. His ideas are easy to implement and will improve anybodies workflow and project quality. Highly recommended for all architects and developers.Ryan Good
Advanced Mabile Propulsion Test
Sam is really focused on improving processes in software development. He provides excellent classes and mentoring on steps that can be taken for us to become better and more efficient at what we do. He also shows you how to make teams more efficient. His training in Test Driven Development can dramatically increase the efficiency of teams as the time spent debugging and correcting issues created in the initial coding can be caught quicker with less work and fixed. This can have the result of reducing your project effort by 40% or better.Bill Welch
CLA, CTD, CPI
Scenic Systems LLC