In big projects (1000+ tests), wouldn't the output get unnecessarily verbose
and increase the test time? Maybe there should be a command-line switch to
control the output level.

 

From: Vlad [mailto:v...@demoninsight.com] 
Sent: November-23-09 12:43 AM
To: UnitTest++ development and use
Subject: [unittest-cpp-devel] enhanced test driver, take two

 

Hi,

            As promised earlier, I've uploaded v2 of my "controversial"
unittest++ patch; essentially the same functionality but without any
external dependencies:
https://sourceforge.net/tracker/download.php?group_id=158151
<https://sourceforge.net/tracker/download.php?group_id=158151&atid=806686&fi
le_id=352150&aid=2900890> &atid=806686&file_id=352150&aid=2900890

 

To power through resistance due to the original boost dependency, I've made
the following changes:

 

1. the full regex filter has been replaced with a simple *,?-wildcard
filter. In most cases, this is what people would want anyway. The
implementation is a C++ port of a similar class from my own open source
project (EMMA).

2. I've written a new class OptParser that works similarly to boost's
program_options. It's a clean room impl based on a simple trie structure
that allows specifying options via unique prefixes and aliases. 

3. I've also added misc utility functions in utils.h for string tokenizing
and other places for replicating boost stuff like lexical_cast<>,
noncopyable, etc. 

 

Since the original value prop has probably been forgotten by now, a quick
reminder:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 

(a) this driver is more verbose, to help users who want to see test
start+end events/when a test locks up/delineate output from tests that
themselves print to the screen

(b) at the end of a run the driver prints a per-suite/per-test summary of
test failures, if any

(c) test suite selection via a command line option

(d) test case inclusion/exclusion via wildcard test name matching (useful
for grouping tests by axes orthogonal to suites when there is a naming
convention in place)

 

 

The uploaded zip contains a modified Makefile that builds an 'alltests' app
which is the new ("rich") driver linked with the UnitTest++ test suite. Here
are some sample runs:

 

 

[23:22:41] unittest>./alltests -h

usage: alltests [options],

where options are:

  -s [-suite] <arg>    test suite to run (default: 'default')

  -i [-include] <arg> (*,?)-filter for tests to include (default: all)

  -x [-exclude] <arg>               (*,?)-filter for tests to exclude
(default: none)

  -t [-maxtesttime] <arg>         global test time constraint [ms] (default:
disabled)

  -h [-help]               get this usage information

 

 

[23:22:50] unittest>./alltests

running suite [<default>]

----------------------------------------------------------------------

START:  ReportAssertThrowsAssertException  [TestAssertHandler.cpp]

FINISH: ReportAssertThrowsAssertException (0.014728 s)

----------------------------------------------------------------------

START:  ReportAssertSetsCorrectInfoInException  [TestAssertHandler.cpp]

FINISH: ReportAssertSetsCorrectInfoInException (4.2e-05 s)

----------------------------------------------------------------------

START:  CheckEqualWithUnsignedLong  [TestChecks.cpp]

FINISH: CheckEqualWithUnsignedLong (2.7e-05 s)

----------------------------------------------------------------------

START:  CheckEqualsWithStringsFailsOnDifferentStrings  [TestChecks.cpp]

FINISH: CheckEqualsWithStringsFailsOnDifferentStrings (8.4e-05 s)

----------------------------------------------------------------------

START:  CheckEqualsWithStringsWorksOnContentsNonConstNonConst
[TestChecks.cpp]

FINISH: CheckEqualsWithStringsWorksOnContentsNonConstNonConst (2.4e-05 s)

----------------------------------------------------------------------

...

----------------------------------------------------------------------

START:  CanSetandGetDetails  [TestCurrentTest.cpp]

FINISH: CanSetandGetDetails (2.3e-05 s)

----------------------------------------------------------------------

START:  CanSetAndGetResults  [TestCurrentTest.cpp]

FINISH: CanSetAndGetResults (2.3e-05 s)

======================================================================

 

  'default' PASSED (175 tests, 0.113777 s)

 

======================================================================

 

 

[select tests that do something with "Equal"]

 

[23:24:34] unittest>./alltests -i "*Equal*"

running suite [<default>]

----------------------------------------------------------------------

START:  CheckEqualWithUnsignedLong  [TestChecks.cpp]

FINISH: CheckEqualWithUnsignedLong (0.00237 s)

----------------------------------------------------------------------

....

----------------------------------------------------------------------

START:  CheckArray2DCloseSucceedsOnEqual  [TestCheckMacros.cpp]

FINISH: CheckArray2DCloseSucceedsOnEqual (3.1e-05 s)

----------------------------------------------------------------------

START:  CheckArray2DCloseFailsOnNotEqual  [TestCheckMacros.cpp]

FINISH: CheckArray2DCloseFailsOnNotEqual (3.2e-05 s)

======================================================================

 

  'default' PASSED (33 tests, 0.005972 s)

 

======================================================================

 

 

Cheers,

Vlad



__________ Information from ESET Smart Security, version of virus signature
database 4629 (20091123) __________

The message was checked by ESET Smart Security.

http://www.eset.com

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
unittest-cpp-devel mailing list
unittest-cpp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/unittest-cpp-devel

Reply via email to