Add init and finish functionality
[platform/core/test/security-tests.git] / README
diff --git a/README b/README
index c946fe7..83c2c05 100644 (file)
--- a/README
+++ b/README
@@ -84,6 +84,22 @@ dpl-test-framework
 Adding/removing those macro calls will add/remove test cases they provide. To
 change tests, change body of those macro calls. Registered tests are run within
 group alphabetically.
+Those macros allow additional arguments which are classes with mandatory
+methods:
+* (constructor) ()
+    Called while registering test.
+    Should not throw any exceptions
+* init(const std::string &testName)
+    Called before test case function in order of classes passed to macro.
+    Should not be forked.
+    testName argument is name of the test (first macro argument).
+* finish(void)
+    called after test case function in reversed order of classes passed to
+    macro.
+    Should not be forked.
+Created instances of those classes may be accessed from within test case body
+as argument of test case funtion is
+  std::tuple<ClassesPassed> &optionalArgsTuple
 
 dpl-test-framework
   test_runner.h
@@ -231,6 +247,30 @@ RUNNER_CHILD_TEST_NOSMACK(bar_file2_dropped_root)
                             "Wrong errno on opening " << " file");
 }
 
+class Env
+{
+public:
+    Env() { ... }
+    void init(const std::string &testName) { ... }
+    void finish() { ... }
+    void doEnv() { ... }
+};
+
+class Restore
+{
+public:
+    Restore() { ... }
+    void init(const std::string &testName) { ... }
+    void finish() { ... }
+    void doRestore() { ... }
+};
+
+RUNNER_TEST(bar_optional_args, Env, Restore)
+{
+    std::get<0>(optionalArgsTuple).doEnv();
+    std::get<1>(optionalArgsTuple).doRestore();
+}
+
 int main(int argc, char *argv[])
 {
     SummaryCollector::Register();