phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maryann...@apache.org
Subject [1/3] phoenix git commit: Add initial version of 'Test Failure Analysis'
Date Wed, 15 Mar 2017 00:01:26 GMT
Repository: phoenix
Updated Branches:
  refs/heads/calcite efd68ab1d -> 5e47b4608


http://git-wip-us.apache.org/repos/asf/phoenix/blob/5e47b460/test_failure_analyzer.py
----------------------------------------------------------------------
diff --git a/test_failure_analyzer.py b/test_failure_analyzer.py
new file mode 100644
index 0000000..4391d07
--- /dev/null
+++ b/test_failure_analyzer.py
@@ -0,0 +1,33 @@
+#!/usr/bin/python
+
+import xml.etree.ElementTree as ET
+import sys
+import os
+import csv
+reload(sys)
+sys.setdefaultencoding('utf-8')
+
+fieldnames = ['classname', 'testcase', 'error_message','type','info'];
+with open('calcite_failed_tests.csv', 'w') as csvfile:
+  writer = csv.DictWriter(csvfile, fieldnames,dialect='excel',delimiter=',');
+  writer.writeheader();
+  target_dir = os.path.join(os.getcwd(),'phoenix-core/target');
+  list_of_dirs = os.listdir(target_dir);
+  for dir in list_of_dirs:
+    if dir == "failsafe-reports" or dir == "surefire-reports":
+      reports_dir = os.path.join(os.getcwd(),os.path.join('phoenix-core/target',dir));
+      list_of_files = os.listdir(reports_dir);
+      for each_file in list_of_files:
+        if each_file.startswith('TEST-'):
+          tree = ET.parse(os.path.join(reports_dir,each_file));
+          root = tree.getroot()
+          for elem in root.iter("testcase"):
+            for child in elem.getchildren():
+	      if child.tag == "failure" or child.tag == "error":
+	        classname = elem.get('classname');
+                testcase = elem.get('name');
+                error_message = child.get('message');
+                type = child.get('type');
+                info = child.text;
+	        writer.writerow({'classname':classname,'testcase':testcase,'error_message':error_message,'type':type,'info':info});
+csvfile.close();


Mime
View raw message