The Search For A Simple C++ Unit Tester : EasyUnit

For a full list of my adventures in search of a c++ unit tester, return to the main page here. This section will focus on one candidate: EasyUnit.

EasyUnit


Documentation: EasyUnit documention

Installation

  1. Downloaded easyunit-1.0-unix.tar.gz
  2. Entered the easyunit-src folder and typed make
    • simplestring.cpp:85 error: bool easyunit::operator==(const easyunit::SimpleString&, const easyunit::SimpleString&) should have been declared inside easyunit
    • Oh dear… well, let’s take a look at the file. Indeed, operator== is declared in the SimpleString class as a friend, but not declared independently outside of the class. Lets fix that.
    • Added 2 lines to simplestring.h:
      • bool operator== (const SimpleString& left, const SimpleString& right);
      • bool operator!= (const SimpleString& left, const SimpleString& right);

    • Tried make again… and it works!

Run An Example


From here, the online documentation is blank (losing points here…), so I get to make it up as I go along. >.<

I moved into the examples folder, focusing on folder 1-BasicUnitTesting. We need several commands to compile this correctly:

>> mkdir easyunit
>> cp ../../easyunit/* easyunit/.
>> g++ -c -o stack.o stack.cpp
>> g++ -c -o stactest.o stacktest.cpp
>> g++ -o test stack.o stacktest.o ~/easyunit/easyunit-src/libeasyunit.a main.cpp

Okay! Now we have an executable called ‘test’ that will run the tests and produce the following output:
EasyUnit First Example

Assessment

After playing around with more examples and making up some of my own, I feel like I have the basic grasp of the language.

Pros

  • Very simple syntax
  • Test framework needs little-to-no changing after initial setup
  • Nice reporting format

Cons

  • Very little documentation
  • No obvious way to create reusable functions within tests

Rating: 7

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s