Fixing a Simple Bug with Test Driven Development

So it was the CLA Summit last week that gave me more opportunity to bang on about software testing either further and was great to discuss it with various people and see the themes coming out of it.

My common theme was that I really like the interactive nature of the Unit Test Framework, I think it plays to LabVIEW’s strengths and allows for a nice workflow (for basic tests, using test vectors is far more long winded than it needs to be!).

Another positive I took was from Steve Watts’ talk on debugging and immediacy. He talked about the advantages of ‘runnable code’, that is having logic contained in subVIs that can run independently which aids the debugging process.

So as I worked this week I came across a bug which, the process of fixing, highlighted this well. I took a screencast of the process to highlight some of the benefits that I have found and I think highlights one of the most commonly cited benefits of testing, better code structure. (Go easy, I’m not as natural on camera!)


  • swatts

    April 27, 2015

    That was really interesting James (I love the idea of showing the process in a screencast). In the future I will drop my term “runnable” for your term “testable” it’s far less cumbersome.

  • Fabiola De la Cueva

    April 27, 2015

    Thanks for sharing your thought process and for giving an excellent example of how test driven development requires a different way of thinking. We need to separate our logic from the integration with the rest of our application.

    I took the liberty of adding this post to the Unit Testing Group as the first real life example of Unit Testing. I hope you don’t mind and hopefully we will get more people sharing their examples:


    • jamesmc86

      April 27, 2015

      No problem at all, I had intended to do the same and may have forgotten so perfect!
      Hopefully wont be the last either, been speaking to a heavy TDD proponent with experience in Javascript and has left me with a nice long reading list on the topic.

  • Javier

    April 27, 2015

    Great video!

  • Olivier Jourdan

    April 29, 2015

    I’ve tried UTF in the past and gave up (for most of my dev) because I didn’t found the right way to determine what VI to test or not to gain quality without spend to much time creating and maintaining tests.
    With you video, I better cached Steve Watts presentation.

    Thanks for sharing.

  • Swinders

    April 29, 2015

    Great video James and nice example of using Unit Testing.

  • Paul Riley

    May 6, 2015

    Thanks James, good example

  • FixedWire

    November 28, 2015

    Great post. However, I find these types of use cases of limited value.

    Just went through your other post

    …now, combining these concepts with unit tests and we’re really onto something! I don’t know how many times using a SNG over a DBL has reared it’s ugly head. This can be easily be the case when other programmers come on board from the text based world. Those are hard bugs to find and would greatly benefit everyone.

    This is could be combined into a module of its own.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.