Merge "Define create_snapshot() and clean() in TestCase"
[functest.git] / docs / com / pres / framework / framework.md
index 61249e0..40d5a6a 100644 (file)
@@ -59,12 +59,14 @@ base model for single test case
 
 ### methods
 
-| Method            | Purpose                                    |
-|-------------------|--------------------------------------------|
-| run(**kwargs)     | run the test case                          |
-| is_successful()   | interpret the results of the test case     |
-| get_duration()    | return the duration of the test case       |
-| push_to_db()      | push the results of the test case to the DB|
+| Method            | Purpose                       |
+|-------------------|-------------------------------|
+| run(**kwargs)     | run the test case             |
+| is_successful()   | interpret the results         |
+| get_duration()    | return the duration           |
+| push_to_db()      | push the results to the DB    |
+| create_snapshot() | save the testing environement |
+| clean()           | clean the resources           |
 
 
 ### run(**kwargs)
@@ -102,7 +104,6 @@ if result == testcase.TestCase.EX_OK:
     if GlobalVariables.REPORT_FLAG:
         test_case.push_to_db()
     result = test_case.is_successful()
-duration = test_case.get_duration()
 ```
 
 
@@ -137,7 +138,6 @@ case_name: first
 project_name: functest
 criteria: 100
 blocking: true
-clean_flag: false
 description: ''
 dependencies:
     installer: ''
@@ -205,7 +205,6 @@ case_name: second
 project_name: functest
 criteria: 100
 blocking: true
-clean_flag: false
 description: ''
 dependencies:
     installer: ''
@@ -239,7 +238,6 @@ case_name: third
 project_name: functest
 criteria: 100
 blocking: true
-clean_flag: false
 description: ''
 dependencies:
     installer: ''
@@ -253,6 +251,61 @@ run:
 
 
 
+## class Suite
+bases: TestCase
+
+base model for running unittest.TestSuite
+
+
+### run(**kwargs)
+
+- allows running any unittest.TestSuite
+- sets the following attributes required to push the results to DB:
+    - result
+    - start_time
+    - stop_time
+    - details
+
+
+
+## Your fourth test case
+
+
+### fourth.py
+
+```python
+#!/usr/bin/env python
+
+import unittest
+
+class TestStringMethods(unittest.TestCase):
+
+    def test_upper(self):
+        self.assertEqual('Hello World'.upper(),
+                         'HELLO WORLD')
+```
+
+
+### functest/ci/testcases.yaml
+
+```
+case_name: fourth
+project_name: functest
+criteria: 100
+blocking: true
+description: ''
+dependencies:
+    installer: ''
+    scenario: ''
+run:
+    module: 'functest.core.unit'
+    class: 'Suite'
+    args:
+        name: 'fourth'
+```
+
+
+
 ## Euphrates