diff PerfsDb/Test.py @ 158:df1f9946571c

perfs db continued: tests working with tiny DBs on all setup but the sqliteplugin
author am@osimis.io
date Fri, 17 Aug 2018 11:58:26 +0200
parents f1a75985caa8
children 27b3b0df5f90
line wrap: on
line diff
--- a/PerfsDb/Test.py	Thu Aug 16 17:14:05 2018 +0200
+++ b/PerfsDb/Test.py	Fri Aug 17 11:58:26 2018 +0200
@@ -17,9 +17,17 @@
     def setRepeatCount(self, repeatCount: int):
         self.repeatCount = repeatCount
 
-    def prepare(self):
+    def beforeAll(self):
+        """
+        Code to execute before the execution of all repetitions of a test; i.e: upload a file.
+        This code is not included in timings
         """
-        Code to execute before the execution of a test; i.e: upload a file (not including in timings)
+        pass
+
+    def beforeEach(self):
+        """
+        Code to execute before the execution of each repetition of a test.
+        This code is not included in timings
         """
         pass
 
@@ -29,24 +37,35 @@
         """
         pass
 
-    def cleanup(self):
+    def afterEach(self):
+        """
+        Code to execute after the execution of each repetition of a test.
+        This code is not included in timings
         """
-        Code to execute after the execution of a test; i.e: remove an instance (not including in timings)
+        pass
+
+    def afterAll(self):
+        """
+        Code to execute after the execution of all repetitions of a test.
+        This code is not included in timings
         """
         pass
 
     def run(self) -> TestResult:
         result = TestResult(self.name)
 
+        self.beforeAll()
+
         for i in range(0, self.repeatCount):
-            self.prepare()
+            self.beforeEach()
             startTime = time.time()
             self.test()
             endTime = time.time()
-            self.cleanup()
+            self.afterEach()
 
             result.add((endTime - startTime) * 1000)
 
+        self.afterAll()
         result.compute()
         return result