"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "test/gui/TestLogParser.py" between
ownCloud-2.9.0.5150.tar.xz and ownCloud-2.9.1.5500.tar.xz

About: ownCloud Client (formerly "mirall") is a tool to synchronize files from ownCloud Server with your desktop client. It uses OCSync as its syncing backend.

TestLogParser.py  (ownCloud-2.9.0.5150.tar.xz):TestLogParser.py  (ownCloud-2.9.1.5500.tar.xz)
skipping to change at line 20 skipping to change at line 20
# Loop level 0 where we loop through all the feature files inside the only t est suites that we have. # Loop level 0 where we loop through all the feature files inside the only t est suites that we have.
for feature_file in data["tests"][0]["tests"]: for feature_file in data["tests"][0]["tests"]:
# Loop through all the features in the feature file # Loop through all the features in the feature file
for feature in feature_file['tests']: for feature in feature_file['tests']:
# Loop through all the scenarios in the feature # Loop through all the scenarios in the feature
for scenario in feature['tests']: for scenario in feature['tests']:
# If the scenario is not skipped, then loop through all the step s in the scenario # If the scenario is not skipped, then loop through all the step s in the scenario
if "tests" not in scenario: if "tests" in scenario:
break
for test_step in scenario['tests']:
# If the test step fails then it contains further "tests" ob
ject
# So loop through all the errors in the test step
if "tests" not in test_step:
break
for error in test_step['tests']:
# Sometimes, the step with assertions operations also co
ntains this "tests" object.
# And we do not consider it to be an error, if there is
a result key with value "PASS"
if "result" in error and error["result"] == "PASS":
break
# Append the information of failing tests into the list
of failing tests
test = {
"Feature File": str(feature_file['name']),
"Feature": str(feature['name']),
"Scenario": str(scenario['name']),
"Test Step": str(test_step['name']),
"Error Details": str(error['detail']),
}
failing_tests.append(test) for test_step in scenario['tests']:
# If the test step fails then it contains further "tests
" object
# So loop through all the errors in the test step
if "tests" in test_step:
for error in test_step['tests']:
# Sometimes, the step with assertions operations
also contains this "tests" object.
# And we do not consider it to be an error, if t
here is a result key with value "PASS"
if 'result' in error and error['result'] == 'PAS
S':
continue
# Append the information of failing tests into t
he list of failing tests
# If the error detail is missing(occurs mainly i
n runtime error) then we display the entire error object.
test = {
"Feature File": str(feature_file['name']),
"Feature": str(feature['name']),
"Scenario": str(scenario['name']),
"Test Step": str(test_step['name']),
"Error Details": str(error['detail'])
if ('detail' in error)
else "Error details not found",
}
failing_tests.append(test)
return failing_tests return failing_tests
def filter_redundancy(raw_data):
unique_scenarios = []
filtered_data = []
for scenario in raw_data:
if scenario['Scenario'] not in unique_scenarios:
unique_scenarios.append(scenario['Scenario'])
filtered_data.append(scenario)
else:
if scenario['Error Details'] != "Error details not found":
for repeated_scenario in filtered_data:
if repeated_scenario['Scenario'] == scenario['Scenario']:
repeated_scenario['Error Details'] = scenario['Error Det
ails']
return filtered_data
f = open(str(sys.argv[1])) f = open(str(sys.argv[1]))
# returns JSON object as a dictionary # returns JSON object as a dictionary
data = json.load(f) data = json.load(f)
# Traverse through the json file to look for failing tests # Traverse through the json file to look for failing tests
failing_tests_raw = traverse_loop(data) failing_tests_raw = traverse_loop(data)
# Remove duplicate nodes, if exists # Remove duplicate nodes, if exists
# This step is neccessary because sometimes the data in failing_tests_raw is red # This step is necessary because sometimes the data in failing_tests_raw is redu
undent. ndant.
failing_tests = [dict(y) for y in set(tuple(x.items()) for x in failing_tests_ra failing_tests = filter_redundancy(failing_tests_raw)
w)]
print(json.dumps(failing_tests, indent=4, sort_keys=True)) print(json.dumps(failing_tests, indent=4, sort_keys=True))
f.close() f.close()
 End of changes. 4 change blocks. 
32 lines changed or deleted 53 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)