Understanding the Value of Unit Testing

Obviously, unit tests have their greatest value at the time of the development of the unit itself. Well-designed unit tests provide evidence that the unit performs its intended function, that the software design executes as intended, and allows the developer (or tester) to test the unit with inputs and states that may be difficult to produce at an integrated level.

However, once that unit is complete, running the unit test again may have very low value. Certainly it will obtain the same result when executed as a unit test. However, this seems to be at odds with the prevailing opinion that unit tests should be run daily or with every build. One might ask the question, “Why should I re-run a unit test for a software unit that has not changed?” Let’s explore this question just a bit.

Re-running a unit test provides some evidence that the software unit did not change, or at least it did not change in such a way that it affected the pass/fail criteria of the unit test. This is an important distinction as there may be some changes to units for which the unit test will not discriminate. Assuming the unit test has adequate and proper coverage, this can be an acceptable situation.

Secondly, when unit tests are automated, re-running is essentially free and it can help convince outsiders like FDA that there has been enough testing. For instance, statements like “100% unit test coverage was repeated with the final build” can be reassuring to the regulator and make it unnecessary or unlikely for them to determine the impact of some unit tests that were run on very early builds of the system. Keep in mind that the term “free” is used loosely here and does not apply to all systems.

Thirdly, you might be using a scheme where the inputs are different for each run or randomized in some fashion. Clearly regression runs of unit tests have value in this case.

Finally, you may use a log generated from a unit test for some other purpose and you need that logged data for the latest release. Rather than having to justify why the data is not from the production release or equivalent, you simply run it again.

SoftwareCPR can provide assistance ranging from validation documentation review and assessment, to hands-on risk-based V&V planning, testing, and development of unit tests automation for standalone or embedded medical device software including Mobile Medical Apps.

Alan Kusinitz provided input and review.

About the author

Brian is a biomedical software engineer - whatever that is! Started writing machine code for the Intel 8080 in 1983. Still enjoys designing and developing code. But probably enjoys his garden more now and watching plants grow ... and grandkids grow!

SoftwareCPR Training Courses:

IEC 62304 and other emerging standards for Medical Device and HealthIT Software

Our flagship course for preparing regulatory, quality, engineering, operations, and others for the activities and documentation expected for IEC 62304 conformance and for FDA expectations. The goal is to educate on the intent and purpose so that the participants are able to make informed decisions in the future.  Focus is not simply what the standard says, but what is meant and discuss examples and approaches one might implement to comply.  Special deep discount pricing available to FDA attendees and other regulators.

3-days onsite with group exercises, quizzes, examples, Q&A.

Instructor: Brian Pate

Next public offering:  TBD

Email training@softwarecpr.com to request a special pre-registration discount.  Limited number of pre-registration coupons.

Registration Link:

TBD

 


 

Being Agile & Yet Compliant (Public or Private)

Our SoftwareCPR unique approach to incorporating agile and lean engineering to your medical device software process training course is now open for scheduling!

  • Agile principles that align well with medical
  • Backlog management
  • Agile risk management
  • Incremental and iterative software development lifecycle management
  •  Frequent release management
  • And more!

2-days onsite (4 days virtual) with group exercises, quizzes, examples, Q&A.

Instructors: Mike Russell, Ron Baerg

Next public offering: March 7 & 28, 2024

Virtual via Zoom

Registration Link:

Register Now

 


 

Medical Device Cybersecurity (Public or Private)

This course takes a deep dive into the US FDA expectations for cybersecurity activities in the product development process with central focus on the cybersecurity risk analysis process. Overall approach will be tied to relevant standards and FDA guidance documentation. The course will follow the ISO 14971:2019 framework for overall structure but utilize IEC 62304, IEC 81001-5-1, and AAMI TIR57 for specific details regarding cybersecurity planning, risk characterization, threat modeling, and control strategies.

2-days onsite with group exercises, quizzes, examples, Q&A.

Instructor: Dr Peter Rech, 2nd instructor (optional)

Next public offering:  TBD

Corporate Office

15148 Springview St.
Tampa, FL 33624
USA
+1-781-721-2921
Partners located in the US (CA, FL, MA, MN, TX) and Canada.