We may earn an affiliate commission when you visit our partners.
Course image
Mark VanderVoord and Mike Karlesky

Welcome to Dr. Surly’s School for Mad Scientists.

Read more

Welcome to Dr. Surly’s School for Mad Scientists.

Unit Testing and Test Driven Development help smart, capable developers like you create robust, reliable, and maintainable software that lets you sleep soundly at night. In this course you will apply these concepts to embedded code and system software in C.

This course introduces the Unity framework, key principles, and a variety of techniques so that you can apply Unit Testing and Test Driven Development in complex and low-level C code. Once you’ve completed this material or if you’re already familiar with TDD and xUnit frameworks our course Interaction Testing, Mocking & Embedded Software in C is a great next step.

Dr. Surly’s School for Mad Scientists

When you’re trying to take over the world you learn two things quite quickly. First, you end up building lots of technology like death rays and such that requires high quality firmware. Second, minions, climate-altering satellites, and lairs are expensive. While Dr. Surly’s lab has become quite proficient at software design and testing, supplemental revenue to fund all manner of villainy is a necessary evil. It’s all part of the standard world domination business model, and you get to benefit.

In This Course You Will:

  • Develop in C using Test Driven Development. Write real, executable tests on your first day.

  • Learn concepts from Agile, XP, Scrum, and Lean practices for producing well designed, high quality, scope-managed, and self-documented code.

  • Utilize the free, open source tool Unity in real-world testing scenarios. No toy examples.

  • Follow us through real-world programming examples and see techniques and patterns for unit testing tricky code.

  • Encounter big idea philosophies for process, design, and testing.

  • Apply your new skills to challenging practice problems.

  • Connect with a supportive community.

Learn How To Apply Unit Testing To Your Embedded and System C Software

You will learn skills that have become staples in higher level languages but are sadly underutilized in the C world. In particular, you will learn to write unit tests in the uniquely challenging setting of embedded and system software.

Of course, the test-driven techniques you will learn produce code that enables thorough, smart testing. But, a happy side effect of TDD is code that tends to adhere to generally good design principles. You won’t only be learning testing in this course but also good design.

This Course Includes:

  • 0x1D (29) Code-centered lectures

  • 0x05 (5) Development projects

  • 0x12 (18) Helpful resource-packed supplemental primers, guides, and how-to's

  • Links, quizzes, helpful hints, and more

Can’t decide? Need something more? Please write us at… [email protected]

Join us in our mission to take over the world (with quality embedded software).

Enroll now

What's inside

Learning objectives

  • Develop embedded and system software in c using unit tests.
  • Apply test driven development practices and design patterns to your own projects.
  • Produce quality, maintainable, and self-documented software designs through test-first thinking.
  • Understand how to use the open source unity test framework
  • Take over the world.

Syllabus

Learn what this course is all about and why you're learning it.

Welcome to our mad scientist lab. If you’re going to take over the world some day, inevitably you're going to be building electronics and programming low level code. You may be insane, but you’re not dumb. You’re taking this course to learn structured and responsible testing practices for low-level code. We’re going to be working in C and using open source tools like Unity to get you writing tests as soon as possible for a variety of example projects. You learn best by doing and so there’s plenty of doing in this course.

If you want to know more about Dr. Surly, the patron saint of mad scientist firmware developers, you can read his much abridged life story. It’s one page, and it’s attached.

Read more

An overview of the material of this course and how it relates to our other courses, quizzes, homework, where to find the pencil sharpener, etc.

Write your very first basic unit tests for C modules.

Unit testing embedded and system code is a relatively new development. In fact, the tool we use in this course was created at a time when many thought such things couldn’t be done.

The nuts and bolts of Section 2 is to push off lots of yacking at you until later in favor of getting you writing tests as soon as possible. Don’t worry. We will address your inevitable questions soon enough. Please be patient.

We need to get you set up before you tear into writing tests. That means being familiar with the documentation we provide and your options for a development environment. In this lecture we discuss:

  1. All the core documentation you’ll want to reference regularly plus a variety of thorough treatments of topics related to this course but outside its immediate scope.

  2. Options for development (a readymade web-based sandbox or do-it-yourself local environment).


Note: We are beginning the process of transitioning the course project development environment from web-based SourceLair (discussed in this video lecture) to locally-installed Docker that is discussed in the next lecture. Please choose SourceLair or Docker for developing your project. We apologize for any added complexity due to the new option.

Here we introduce an alternative—and eventual replacement—for SourceLair as your development environment. All the needed tools and project materials are included in a Docker image you can execute locally. Please choose SourceLair or Docker moving forward.


Note: We are beginning the process of transitioning this course from using SourceLair to using a locally executed development environment packaged up as a Docker image. Executing commands at the SourceLair terminal shown in other lectures is virtually identical to doing so at the command line within the Docker environment.

If you chose to use the web-based development sandbox we introduced in the previous lecture, in this lecture we walk you through that environment and how it will be used in the course. Together we will verify that your setup is working properly.


Note: Running commands in SourceLair’s terminal are virtually identical to doing the same using the Docker-based local development environment we introduced as an alternative to SourceLair in the preceding lecture. The big differences between SourceLair and the Docker-based environment are (A) Web-based vs. local execution (B) Using a web-based code editor vs. using your own favorite local code editor.

This lecture covers your options for asking questions not addressed in the course material. For instance, you may need help debugging issues in the previous step (lecture). Or, you may have specific technical or philosophical questions that arise during the rest of the course.

The testing setup we employ early on is easy to use and generally problem free. Our supplemental documents cover lots of issues and potential questions. But if you're stuck, you have several options for help.

In this lecture we guide you through developing and running your very first shiny new unit tests using Unity!

A tiny pop-quiz to verify you understood the last section

In this lecture we guide you through developing a full set of unit tests for a real source code module! Along the way we show you how to think through just what exactly should be tested and then how to structure your unit tests to accomplish this.

We give you a challenge where you can apply the skills you’ve learned on your own.

In this lecture we explain what's happening under the hood of these testing tools and why the tools were designed the way they are. We break down a project's code in diagrams to show how your source and test code live separately but in harmony.

We get into the nitty gritty of how and where you actually run your executable unit tests:

  • Locally (native)

  • In a simulator

  • On target

And we address the scope of testing approaches:

  • Unit

  • Integration

  • System

For more on the fine details of unit, integration, and system testing, please see our supplemental “Extra Goodness” document (document archive attached to Lecture 4): What’s the difference? Unit, Integration, and System Testing.

Lecture Appendix

If you want to really dig in to understand a testing framework like Unity:

  • Go ahead and look at Unity’s source code: https://github.com/ThrowTheSwitch/Unity/

  • Take a gander at MinUnit—A minimal unit testing framework for C in 3 lines of code: http://www.jera.com/techinfo/jtns/jtn002.html

Section Wrapup and Review

Develop source modules and unit tests at the same time for better code!

We introduce Section 3 and lay out how you can grow your source code and test code together, in parallel, at the same time.

In this lecture we walk you through creating a new embedded source module from scratch. You will begin building a real GPIO module and unit testing all the necessary register settings as you build up the code from requirements. You’ll be developing the source and the tests together. We identify and demonstrate good practices as we go.

We verify that you have this whole flow-thing down.

We introduce the concepts of Test-Driven Development and Behavior-Driven Development. Surprise! You’ve already been using these concepts. We explain their principles and many benefits… and how they apply to building up a suite of unit tests.

In this lecture we share useful resources on the concepts covered in the previous lecture. Additionally we point you to a variety of studies on and philosophical discussions about the value and tradeoffs of unit testing itself. With the materials of this lecture you will be able to speak intelligently to your colleagues about both the pros and cons of unit testing practice. We also assign some homework.

In this lecture we further develop the embedded GPIO module we began in this section and we pick up the pace a little. We continue demonstrating test-first and behavior-driven test development for additional pieces of the GPIO interface.

And, we specifically address good practices for working with:

  • Newly implemented but mostly blank functions

  • Error codes and conditions

  • Bounds checking

Registers are fairly simple—except when they’re not. Different processors use different styles of register interaction and produce a variety of behaviors. See our supplemental document (attached in Lecture 4): Testing Special Cases for more perspective on testing tricky register interactions.

We assign some homework for you in the GPIO module of this section to complete using your new skills.

In this lecture we take a step back and discuss two important concepts underlying the decisions we've been making along the way:

  • Do the Simplest Thing That Could Possibly Work

  • Ya Ain’t Gonna Need It

These are powerful concepts that may feel a little wrong at first. We explain why they are a good way to work and how testing plays nice with these approaches. We then demonstrate them in action in testing the Init() function of our GPIO module.

We give another brief quiz to verify our progress.

In this lecture we work through a case that seems complicated on its surface. Our mantra of Simplest Thing That Could Possibly Work seems to lead us to call source functions in our unit tests that are outside the test case under development. We show how to think through decomposing these rather common cases into tests and also introduce setUp() and tearDown() within the testing framework.

We assign the final homework assignment for this section. Once completed, you will have a fully working embedded GPIO module and a full suite of unit tests to verify that it works.

Section Wrapup & Review

Apply state-based testing concepts to common software modules and development tasks.

We discuss where all our work so far belongs in the grand scheme of things and explain how and where our testing approach applies beyond only the work we've done so far.

This section will help you think about the “edges” of your code and how testing applies to common scenarios of state machines, math functions, and data containers.

For an in-depth look at testing special cases (e.g. main(), for() loops, various register setting scenarios), see our supplemental “Extra Goodness” document (in the archive attached to Lecture 4): Testing Special Cases.

In this lecture we walk through the development and testing of a State Machine module used to implement a protocol parser. We discuss and demonstrate how all our recently developed skills apply quite well to this sort of module.

You complete the protocol parsing state machine module from the previous lecture using everything you’ve learned.

We walk you through the development of Math Function module with our approach by demonstrating the development of a well-tested low pass filter.

You complete the Fibonacci module from the previous lecture on your own using all that you’ve learned.

We walk through the development of a data container module (a circular buffer) using all our newly acquired methods and skills.

Once again you complete the circular buffer implementation from the previous lecture using everything you’ve learned along the way.

We review all the work we’ve done in all the sections of our course and where it falls in the scheme of things. Go on towards world domination with your mad scientist plans.

For an in-depth look at testing special cases (e.g. main(), for() loops, various register setting scenarios), see our supplemental “Extra Goodness” document (in the archive attached to Lecture 4): Testing Special Cases. Heck, take a look at all the documents in the archive as they will address many issues we can’t cover in the main course.

Good to know

Know what's good
, what to watch for
, and possible dealbreakers
Introduces testing fundamentals, including unit, integration, and system testing, providing a solid grounding for effective testing
Emphasizes test-driven development (TDD) and behavior-driven development (BDD) to promote a methodical and structured approach to code development
Utilizes the Unity framework, an industry-standard tool for unit testing in C, enabling students to apply their knowledge in a practical setting
Guides students through real-world programming examples, showcasing techniques and patterns for unit testing tricky code
Offers a supportive community of learners and instructors, fostering opportunities for collaboration and peer learning
Requires a foundational understanding of C programming, limiting accessibility for absolute beginners

Save this course

Save Unit Testing & Other Embedded Software Catalysts to your list so you can find it easily later:
Save

Activities

Be better prepared before your course. Deepen your understanding during and after it. Supplement your coursework and achieve mastery of the topics covered in Unit Testing & Other Embedded Software Catalysts with these activities:
Basic Unit Test Drills
Solidify your understanding of the core concepts of unit testing by practicing the basics.
Browse courses on Test-Driven Development
Show steps
  • Review lecture material on unit testing
  • Complete practice problems on writing unit tests
Advanced Unit Testing Concepts
Enhance your unit testing skills by exploring advanced concepts and techniques.
Browse courses on Mock Testing
Show steps
  • Research advanced unit testing concepts
  • Follow online tutorials or workshops
  • Experiment with different approaches
Mentor Junior Unit Testers
Deepen your understanding of unit testing by mentoring others and sharing your knowledge.
Browse courses on Code Review
Show steps
  • Identify opportunities to mentor junior unit testers
  • Provide guidance and support
  • Review and provide feedback on their code
One other activity
Expand to see all activities and additional details
Show all four activities
Unit Testing Workshop
Expand your knowledge and network with other unit testing professionals at a specialized workshop.
Show steps
  • Research and identify relevant workshops
  • Attend the workshop
  • Actively participate and engage with speakers
  • Follow up with attendees and explore collaboration opportunities

Career center

Learners who complete Unit Testing & Other Embedded Software Catalysts will develop knowledge and skills that may be useful to these careers:
Software Engineer
Software Engineers design, develop, and maintain software systems. This course is an excellent fit for aspiring Software Engineers, as it provides hands-on experience with unit testing and test-driven development, which are in-demand skills in the software industry.
Safety-Critical Software Engineer
Safety-Critical Software Engineers design and develop software for systems where failure could have catastrophic consequences. This course is highly relevant for Safety-Critical Software Engineers, as it provides a comprehensive understanding of unit testing and test-driven development for safety-critical systems, which is essential for ensuring the reliability and performance of these systems.
Firmware Engineer
Firmware Engineers design and develop firmware, which is software that is embedded in hardware devices. This course is highly relevant for Firmware Engineers, as it provides a comprehensive understanding of unit testing and test-driven development for embedded systems, which is essential for ensuring the reliability and performance of firmware.
Embedded Systems Engineer
Embedded Systems Engineers design and develop software for embedded systems, which are computers that are part of larger systems. This course is highly relevant for Embedded Systems Engineers, as it provides a deep dive into unit testing and test-driven development for embedded systems, which is essential for ensuring the reliability and performance of these systems.
Real-Time Software Engineer
Real-Time Software Engineers design and develop software that must meet strict timing requirements. This course is highly relevant for Real-Time Software Engineers, as it provides a deep understanding of unit testing and test-driven development for real-time systems, which is essential for ensuring the reliability and performance of these systems.
Test Engineer
Test Engineers design and execute tests to evaluate the functionality and performance of software products. This course is an excellent choice for Test Engineers, as it provides a strong foundation in unit testing and test-driven development, which are industry-standard testing practices.
Software Developer in Test
Software Developers in Test write and execute tests to evaluate the functionality and performance of software products. This course is highly relevant for Software Developers in Test, as it provides a strong foundation in unit testing and test-driven development, which are industry-standard testing practices.
Systems Software Engineer
Systems Software Engineers design and develop software that runs on computer systems, such as operating systems and device drivers. This course is highly relevant for Systems Software Engineers, as it provides a strong foundation in unit testing and test-driven development for systems software, which is essential for ensuring the reliability and performance of these systems.
Test Automation Engineer
Test Automation Engineers design and develop automated tests to evaluate the functionality and performance of software products. This course is highly relevant for Test Automation Engineers, as it provides a comprehensive understanding of unit testing and test-driven development, which are essential for developing and maintaining effective automated tests.
Quality Assurance Engineer
Quality Assurance Engineers test and evaluate software products to ensure they meet quality standards. This course is highly relevant for Quality Assurance Engineers, as it provides a thorough understanding of unit testing and test-driven development, which are essential for ensuring software quality.
Software Architect
Software Architects design and oversee the development of software systems. This course may be useful for Software Architects as it provides a foundation in unit testing and test-driven development, which are important practices for ensuring the quality and maintainability of software systems.
Technical Lead
Technical Leads lead teams of software engineers and are responsible for the technical direction of software development projects. This course may be useful for Technical Leads as it provides a foundation in unit testing and test-driven development, which are essential practices for ensuring the quality and efficiency of software development projects.
Software Quality Analyst
Software Quality Analysts evaluate the quality of software products and recommend improvements. This course may be useful for Software Quality Analysts as it provides a foundation in unit testing and test-driven development, which are essential practices for ensuring the quality of software products.
Software Development Manager
A Software Development Manager oversees the creation of software products, ensuring that they are developed efficiently and meet the needs of users. This course may be useful for Software Development Managers as it provides a foundation in unit testing and test-driven development, which are essential practices for ensuring the quality and reliability of software products.
Software Project Manager
Software Project Managers plan, organize, and manage software development projects. This course may be useful for Software Project Managers as it provides a foundation in unit testing and test-driven development, which are important practices for ensuring the quality and success of software development projects.

Reading list

We've selected 13 books that we think will supplement your learning. Use these to develop background knowledge, enrich your coursework, and gain a deeper understanding of the topics covered in Unit Testing & Other Embedded Software Catalysts.
Provides a practical guide to test-driven development for embedded C systems. It covers the basics of TDD, as well as more advanced topics such as mocking and testing legacy code.
Novel that tells the story of a fictional company that is struggling to adopt DevOps. It provides a practical and entertaining way to learn about the benefits of DevOps.
Is the definitive guide to the C programming language. It covers the basics of the language, as well as more advanced topics such as pointers and memory management.
Provides a comprehensive guide to embedded software development with C. It covers the basics of embedded systems, as well as more advanced topics such as real-time programming and memory management.
Provides a catalog of design patterns, which are general solutions to common software design problems. It covers a wide range of design patterns, from creational patterns to structural patterns to behavioral patterns.
Provides a comprehensive guide to DevOps. It covers the basics of DevOps, as well as more advanced topics such as cultural change and metrics.
Provides a practical guide to site reliability engineering. It covers the basics of SRE, as well as more advanced topics such as incident response and capacity planning.
Provides a practical guide to design patterns. It uses a humorous and engaging approach to explain the concepts of design patterns and how to apply them in your own code.
Provides a practical guide to agile testing. It covers the basics of agile testing, as well as more advanced topics such as test automation and continuous integration.
Provides a modern and up-to-date guide to the C programming language. It covers the latest features of the language, as well as best practices for writing safe and efficient code.

Share

Help others find this course page by sharing it with your friends and followers:

Similar courses

Here are nine courses similar to Unit Testing & Other Embedded Software Catalysts.
C# Unit Testing
Most relevant
Unit Testing Dotnet (.NET) Application with xUnit .net &...
Most relevant
Learn Unit Testing with NUnit and C#
Most relevant
Implementing C# 10 Unit Testing Using Visual Studio 2022...
Most relevant
Unit Testing and Test Driven Development in Python
Most relevant
Effective C# Unit Testing for Enterprise Applications
Most relevant
Introduction to Test and Behavior Driven Development
Most relevant
Unit Testing C Code in CLion 2020
Most relevant
Advanced C++ Mocking Using Google Mock 1
Most relevant
Our mission

OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.

Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.

Find this site helpful? Tell a friend about us.

Affiliate disclosure

We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.

Your purchases help us maintain our catalog and keep our servers humming without ads.

Thank you for supporting OpenCourser.

© 2016 - 2024 OpenCourser