Print Page | Close Window

The abstract Test Case interface

Printed From: One Stop Testing
Category: Software Testing @ OneStopTesting
Forum Name: Test Cases @ OneStopTesting
Forum Discription: You must be well versed in writting Good Test Cases as they only will decide whether you can catch most of bugs or not.
URL: http://forum.onestoptesting.com/forum_posts.asp?TID=162
Printed Date: 15May2024 at 10:00am


Topic: The abstract Test Case interface
Posted By: praveen
Subject: The abstract Test Case interface
Date Posted: 22Feb2007 at 6:30pm
Synopsis
class test_case
{
public:
void set_timeout( int timeout );
void set_expected_failures( unit_test_counter exp_fail );
void depends_on( test_case const* rhs );

void run();
};


Abstract class test_case define the test case interface. You could use methods of this interface to manage test case behavior.

Use method test_case:set_timeout(...) to set the timeout value for the test case. See method http://www.boost.org/libs/test/doc/components/execution_monitor/execution_monitor.html - execution_monitor::execute(...) for more details about the timeout value.

Use method test_case::set_expected_failures(...) to set the expected amount of http://www.boost.org/libs/test/doc/components/test_tools/index.html - Test Tools failures in the test case. In most cases it's more convenient to set these parameters while adding this test_case to a test_suite. See the method http://www.boost.org/libs/test/doc/components/utf/components/test_suite/index.html - test_suite ::add(...) for more details.

Use method test_case::depends_on(...) to define inter test cases dependencies. You could use this feature to prohibit one test case from running if test case it depends on failed. See http://www.boost.org/libs/test/doc/examples/unit_test_example3.html - unit_test_example3 for example.

Use method test_case::run() to start the test case processing. In majority of the cases you don't need to call this method directly: test cases invocation is done and managed by the framework.

Construction

You will never need to create instances of the class test_case.




Print Page | Close Window