crpcut

Software Screenshot:
crpcut
Software Details:
Version: 1.9.2
Upload Date: 20 Feb 15
Developer: Bjorn Fahller
Distribution Type: Freeware
Downloads: 5

Rating: nan/5 (Total Votes: 0)

crpcut (pronounced "crap cut") is the Compartmented Robust Posix C++ Unit Tester. With crpcut it's easy to write tests that other unit-test frameworks cannot manage.

Introductory example:

An example testing parts of std::string:

 #include < crpcut.hpp >
 #include < string >

 struct apastr // fixture for mosts tests
 {
 apastr() : s("apa") {}
 std::string s;
 };

 TESTSUITE(basics)
 {
 TEST(default_constr_and_destr)
 {
 std::string s;
 ASSERT_TRUE(s.empty());
 ASSERT_EQ(s.length(), 0);
 }
 TEST(constr_from_char_array, apastr,
 DEPENDS_ON(default_constr_and_destr))
 {
 ASSERT_EQ(s.length(), 3UL);
 }
 TEST(at, apastr,
 DEPENDS_ON(default_constr_and_destr))
 {
 ASSERT_EQ(s.at(1), 'p');
 }
 }

 TESTSUITE(errors, DEPENDS_ON(ALL_TESTS(basics)))
 {
 TEST(at_out_of_range, apastr,
 EXPECT_EXCEPTION(std::out_of_range))
 {
 s.at(4);
 }
 TEST(index_oper_out_of_range, apastr,
 EXPECT_SIGNAL_DEATH(SIGABRT),
 NO_CORE_FILE)
 {
 s[4];
 }
 }

 int main(int argc, char *argv[])
 {
 return crpcut::test_case_factory::run_test(argc, argv);
 }


Similar tests benefits from being grouped into test-suites. Test-suites can depend on other test-suites, meaning that the contained tests will only run if all tests it depends on have completed successfully. Results can be validated using a number of ASSERT macros. Tests can use fixtures to express common contents. Tests can be expected to exit by exception, or die. Expectations that are not met are errors. Messages on stderr and stdout are gaught, and included in the result log.

Why crpcut

Most importantly, it must be easy to write tests. With crpcut, you focus on your test structure and test logic, not on the limits imposed by your test environment.

With crpcut, every test case runs in its own process and its own working directory. If a test case fails, the process terminates immediately, before it does further harm. This means that every test case starts from a clean slate, unaffected by other tests. This is the compartmentalization.

It also means that the test suite continues, even if a test crashes. You can set deadlines for test cases, and if the allowed time is seriously overdrawn, the test case process is killed. These two make up the robustness part.

You can define dependencies between test cases and between test suites, so that if a fundamental tests fails, the tests that are based on the fundamental functionality will not even be run.

The crpcut main process does not have any dynamic memory allocated at the time a test case process is started, so you can run crpcut using a memory test tool, such as valgrind, and if there is memory allocated when the test case process terminates, you can be assured that you have found a memory leak in your test.

If you have a multi-core CPU, it may be beneficial to run several test cases in parallel. crpcut allows that.

If there are files left in the test process' working directory after the test case process has terminated, the test case is considered failed. The working directory is left untouched by crpcut, for you to examine.

What is new in this release:

  • This version supports distributions with old versions of CMake.

What is new in version 1.9.1:

  • libcrpcut_basic.so was built but not installed

What is new in version 1.8.4:

  • This is a minor bugfix release correcting valgrind instrumentation problems, test dependencies and faulty test duration attribute in XML reports.

What is new in version 1.8.2:

  • This minor feature enhancement makes the command line parameter --timeout-multiplier=factor now also have effect on the timeouts for fixture construction and destruction.

What is new in version 1.8.1:

  • This minor feature enhancement makes the command line parameter --timeout-multiplier=factor now also have effect on the timeouts for fixture construction and destruction.

What is new in version 1.7.2:

  • This version fixes a minor bug with the NO_CORE_FILE test modifier which occurred on Linux when /proc/sys/kernel/core_pattern described piping the core dump to a program rather than saving to a file.

What is new in version 1.6.1:

  • This is a patch for a bug that in some cases caused malformed XML-output by missing a close on the blocked_tests list.

What is new in version 1.6.0:

  • The new features are an additional optional parameter to ASSERT_THROW() and VERIFY_THROW() which checks the value of an exception object, two istream based version of get_parameter() to pick values passed from the command line , and an option to build libcrpcut as static or shared library.

What is new in version 1.5.0:

  • The major new feature is tagging of tests. Tags are a test selection method orthogonal to that of testsuites. Tags can also be used to distinguish between test that are critical (e.g. regressions) and test that are non-critical (e.g. the functionality currently worked on.)
  • Experimental support is also available for decorating test reports with, for example, ANSI-colour escapes.

Similar Software

lava-dashboard
lava-dashboard

20 Feb 15

lava-core
lava-core

14 Apr 15

NoseDBReport
NoseDBReport

20 Feb 15

Comments to crpcut

Comments not found
Add Comment
Turn on images!