Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
SHTK_UNITTEST_ADD_FIXTUR(3) Library Functions ManuaSHTK_UNITTEST_ADD_FIXTUR(3)

NAME
       shtk_unittest_add_fixture -- Defines a test fixture

LIBRARY
       shtk_import unittest

SYNOPSIS
       shtk_unittest_add_fixture name

DESCRIPTION
       The  shtk_unittest_add_fixture  function	registers the fixture given by
       name.  A	function named `<name>_fixture'	must be	defined	after the call
       to shtk_unittest_add_fixture has	been made.

       Fixture functions must not directly contain any code.  All they can  do
       is  define  other  functions,  such  as setup and teardown, and execute
       calls to	shtk_unittest_add_test(3).

EXAMPLES
       The following piece of code illustrates the components of a  test  fix-
       ture:

	     shtk_unittest_add_fixture my_collection
	     my_collection_fixture() {
		 setup() {
		     ... optional function providing per-test setup code ...
		 }

		 teardown() {
		     ... optional function providing per-test teardown code ...
		 }

		 shtk_unittest_add_test	first_scenario
		 first_scenario_test() {
		     ... test code for the first test case ...
		 }

		 shtk_unittest_add_test	second_scenario
		 second_scenario_test()	{
		     ... test code for the second test case ...
		 }
	     }

SEE ALSO
       shtk(3),	shtk_unittest(3)

HISTORY
       shtk_unittest_add_fixture first appeared	in shtk	1.6.

FreeBSD	Ports 14.quarterly     November	8, 2014	  SHTK_UNITTEST_ADD_FIXTURE(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=shtk_unittest_add_fixture&sektion=3&manpath=FreeBSD+Ports+14.3.quarterly>

home | help