Go to Post I believe everyone should give a modicum of repsect to each person they meet for the first time. After that it is up to them as to whether to give you a reason to increase that respect or detract from it. - Al Skierkiewicz [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 20-03-2016, 20:17
althebaker43 althebaker43 is offline
Registered User
FRC #2135
 
Join Date: Jan 2015
Location: San Jose
Posts: 3
althebaker43 is an unknown quantity at this point
Unit Testing with CppUTest

I've thought a lot about strategies for testing robot code, since existing methods (directly testing hardware and Gazebo simulation) don't seem adequate to me. I'm a big fan of unit-testing and Test Driven Development (I use them extensively in my own projects), and recently I've figured out a way to use the CppUTest framework with C++ robot projects that use WPILib. Step-by-step instructions for getting started are available at this blog post I wrote:

http://www.botbakery.net/2016/03/uni...putest-in.html

Sample code with unit tests and a mock WPILib is here:

https://github.com/althebaker43/frc_cpputest_examples

CppUTest homepage:

https://cpputest.github.io/

For Java projects, a similar strategy that involves the JUnit framework could probably be used.

I know it's pretty late in the season to post this, but perhaps it could be useful for some last-minute code hardening before heading off to your final competitions.

Any feedback is appreciated.
Reply With Quote
  #2   Spotlight this post!  
Unread 25-03-2016, 00:11
FleventyFive FleventyFive is offline
Registered User
FRC #4118
 
Join Date: Sep 2014
Location: Gainesville, FL
Posts: 23
FleventyFive is on a distinguished road
Re: Unit Testing with CppUTest

I would really like to have a nice unit testing framework for C++ FRC code. There's been a lot of work in Java to write abstractions around WPILib for easy testing. I'd be happy to help with making something similar for C++. We would basically make a bunch of abstract classes like "Motor" that are implemented by both the real hardware SpeedController and any fake test ones you may wish to write. It's kind of a large undertaking, as WPILib is actually pretty big, especially when you start looking at the Command stuff.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 13:30.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi