bringing in testkit tools
[feisty_meow.git] / testkit / examples / blank_test.sh
1 #!/bin/bash
2
3 # Test: X
4 # Author: Y
5
6 export WORKDIR="$( \cd "$(\dirname "$0")" && \pwd )"  # obtain the script's working directory.
7 cd "$WORKDIR"
8
9 # this needs to be relative to where the test will actually reside; the ../../../../../etc
10 # should get to the top of the tools and tests hierarchy.
11 source "../prepare_tools.sh" "../prepare_tools.sh"
12 if [ -z "$TEST_TEMP" ]; then
13   echo The TestKit could not be automatically located.
14   exit 1
15 fi
16
17 if [ -z "$TESTKIT_SENTINEL" ]; then echo Please run prepare_tools.sh before testing.; exit 3; fi
18 source "$TESTKIT_ROOT/library/establish_environment.sh"
19
20 oneTimeSetUp()
21 {
22   # a test environment initializer method called directly by shunit.
23   # you can add your own code here that is needed before the test run starts.
24   true
25 }
26
27 # this exact test should always be the first one in a test suite.
28 testSanity()
29 {
30   # make sure the test environment is good.
31   sanity_test_and_init
32   assertEquals "sanity test" 0 $?
33 }
34
35 testCleaningPriorTestRun()
36 {
37   echo taking steps to clean last test...
38 #if any.
39 }
40
41 testDoAThing()
42 {
43   echo doing one thing
44   assertEquals "doing that thing should work" 0 $?
45 }
46
47 testDoAnotherThing()
48 {
49   echo doing another thing here
50   assertEquals "doing that other thing should work" 0 $?
51
52   echo "about to cause a failure, to test assertNotEquals..."
53   false
54   assertNotEquals "an explicit failure should be seen" 0 $?
55 }
56
57 oneTimeTearDown() {
58   echo cleaning up after test now...
59 #if anything to do.
60 }
61
62 # load and run shUnit2
63 source "$SHUNIT_DIR/shunit2"
64