-
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* experimental - adding coverage button * Does not crash when tests include subtests * Output all subtest errors * Add tests for error and status results
- Loading branch information
1 parent
a6f46be
commit 3db6b0b
Showing
6 changed files
with
138 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import unittest | ||
from cricket.executor import parse_status_and_error | ||
from cricket.model import TestMethod | ||
|
||
|
||
class TestErrorAndStatus(unittest.TestCase): | ||
def test_status_returned(self): | ||
expected_error_definitions = { | ||
'OK': TestMethod.STATUS_PASS, | ||
's': TestMethod.STATUS_SKIP, | ||
'F': TestMethod.STATUS_FAIL, | ||
'x': TestMethod.STATUS_EXPECTED_FAIL, | ||
'u': TestMethod.STATUS_UNEXPECTED_SUCCESS, | ||
'E': TestMethod.STATUS_ERROR, | ||
} | ||
for error_code, expected_status in expected_error_definitions.items(): | ||
with self.subTest('error code ' + error_code): | ||
status, error = parse_status_and_error( | ||
{'end_time': 1500000000, | ||
'status': error_code, | ||
'description': 'Some Test', | ||
'error': '', | ||
'output': '', | ||
} | ||
) | ||
self.assertEqual(status, expected_status) | ||
|
||
def test_error_returned(self): | ||
sample_error = 'something broke' | ||
expect_error_text = ['s', 'F', 'x', 'E'] | ||
for error_code in expect_error_text: | ||
with self.subTest('error text returned for code ' + error_code): | ||
status, error = parse_status_and_error( | ||
{'end_time': 1500000000, | ||
'status': error_code, | ||
'description': 'Some Test', | ||
'error': sample_error, | ||
'output': '', | ||
} | ||
) | ||
self.assertIn(sample_error, error) | ||
|
||
def test_error_not_returned(self): | ||
sample_error = 'something broke' | ||
expect_no_error_text = ['OK', 'u'] | ||
for error_code in expect_no_error_text: | ||
with self.subTest('error is none when error code is ' + error_code): | ||
status, error = parse_status_and_error( | ||
{'end_time': 1500000000, | ||
'status': error_code, | ||
'description': 'Some Test', | ||
'error': sample_error, | ||
'output': '', | ||
} | ||
) | ||
self.assertIsNone(error) |