Skip to contentSkip to conversation

oeqa: write @OETestTag content into json test reports for each case

PATCH New Alexander Kanavin 1 participant 1 message Aug 7, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 oeqa: write @OETestTag content into json test reports for each case

This allows using these tags for classification and filtering of test results according to various organization-specific criteria, such as teams responsible for the test, internal test ids, feature domains and so on.

Test name itself meanwhile can stay short and human-readable.

---
 meta/lib/oeqa/core/runner.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
meta/lib/oeqa/core/runner.py +14 -0
index 00b7d0bb12..d50690ab37 100644
@@ -195,6 +195,20 @@ class OETestResult(_TestResult):
                 report['log'] = log
             if duration:
                 report['duration'] = duration
+
+            alltags = []
+            # pull tags from the case class
+            if hasattr(case, "__oeqa_testtags"):
+                alltags.extend(getattr(case, "__oeqa_testtags"))
+            # pull tags from the method itself
+            test_name = case._testMethodName
+            if hasattr(case, test_name):
+                method = getattr(case, test_name)
+                if hasattr(method, "__oeqa_testtags"):
+                    alltags.extend(getattr(method, "__oeqa_testtags"))
+            if alltags:
+                report['oetags'] = alltags
+
             if dump_streams and case.id() in self.logged_output:
                 (stdout, stderr) = self.logged_output[case.id()]
                 report['stdout'] = stdout
Signature · 1 line
2.28.0