Skip to content

Commit

Permalink
Fix up tests to match GTest report changes
Browse files Browse the repository at this point in the history
Expect extra ProcessChecks suite in every report.
  • Loading branch information
ryan-collingham committed Mar 11, 2020
1 parent 327faae commit dbb2617
Show file tree
Hide file tree
Showing 9 changed files with 131 additions and 33 deletions.
2 changes: 1 addition & 1 deletion tests/functional/testplan/testing/cpp/test_gtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
(
os.path.join(fixture_root, "empty"),
gtest.empty.report.expected_report,
Status.UNKNOWN,
Status.PASSED,
),
),
)
Expand Down
18 changes: 11 additions & 7 deletions tests/functional/testplan/testing/fixtures/base/failing/report.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
import re

from testplan.report import TestReport, TestGroupReport, TestCaseReport, Status
from testplan.report import (
TestReport,
TestGroupReport,
TestCaseReport,
RuntimeStatus,
)

testcase_report = TestCaseReport(
name="failure",
name="ExitCodeCheck",
entries=[
{
"type": "RawAssertion",
"description": "Process failure details",
# 'content': ''
"description": "Process exit code check",
"passed": False,
}
],
)

testcase_report.status_override = Status.ERROR

testcase_report.runtime_status = RuntimeStatus.FINISHED

expected_report = TestReport(
name="plan",
Expand All @@ -24,7 +28,7 @@
category="dummytest",
entries=[
TestGroupReport(
name="ProcessFailure",
name="ProcessChecks",
category="testsuite",
entries=[testcase_report],
)
Expand Down
37 changes: 35 additions & 2 deletions tests/functional/testplan/testing/fixtures/base/passing/report.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,39 @@
from testplan.report import TestReport, TestGroupReport
from testplan.report import (
TestReport,
TestGroupReport,
TestCaseReport,
RuntimeStatus,
)
from testplan.testing.multitest.entries.assertions import RawAssertion

testcase_report = TestCaseReport(
name="ExitCodeCheck",
uid="ExitCodeCheck",
suite_related=True,
entries=[
{
"type": "RawAssertion",
"description": "Process exit code check",
"passed": True,
}
],
)

testcase_report.runtime_status = RuntimeStatus.FINISHED

expected_report = TestReport(
name="plan",
entries=[TestGroupReport(name="MyTest", category="dummytest", entries=[])],
entries=[
TestGroupReport(
name="MyTest",
category="dummytest",
entries=[
TestGroupReport(
name="ProcessChecks",
category="testsuite",
entries=[testcase_report],
),
],
),
],
)
21 changes: 12 additions & 9 deletions tests/functional/testplan/testing/fixtures/base/sleeping/report.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,32 @@
import re

from testplan.report import TestReport, TestGroupReport, TestCaseReport, Status
from testplan.report import (
TestReport,
TestGroupReport,
TestCaseReport,
Status,
RuntimeStatus,
)

testcase_report = TestCaseReport(
name="failure",
name="ExitCodeCheck",
entries=[
{
"type": "RawAssertion",
"description": "Process failure details",
# 'content': ''
"description": "Process exit code check",
"passed": False,
}
],
)

testcase_report.status_override = Status.ERROR

testcase_report.runtime_status = RuntimeStatus.FINISHED

my_test_report = TestGroupReport(
name="MyTest",
category="dummytest",
entries=[
TestGroupReport(
name="ProcessFailure",
name="ProcessChecks",
category="testsuite",
entries=[testcase_report],
)
Expand All @@ -37,8 +42,6 @@
}
]


my_test_report.status_override = Status.ERROR


expected_report = TestReport(name="plan", entries=[my_test_report])
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,21 @@
name="plan",
entries=[
TestGroupReport(
name="MyGTest", category="gtest", entries=[], tags=None
)
name="MyGTest",
category="gtest",
tags=None,
entries=[
TestGroupReport(
name="ProcessChecks",
category="testsuite",
entries=[
TestCaseReport(
name="ExitCodeCheck",
entries=[{"type": "RawAssertion", "passed": True}],
),
],
),
],
),
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
),
TestCaseReport(
name="NegativeNos",
status_override="passed",
entries=[],
entries=[{"type": "RawAssertion", "passed": True}],
),
],
),
Expand All @@ -37,8 +36,19 @@
),
TestCaseReport(
name="NegativeNos",
status_override="passed",
entries=[],
entries=[{"type": "RawAssertion", "passed": True}],
),
],
),
TestGroupReport(
name="ProcessChecks",
category="testsuite",
entries=[
TestCaseReport(
name="ExitCodeCheck",
entries=[
{"type": "RawAssertion", "passed": False}
],
),
],
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
entries=[
TestCaseReport(
name="PositiveNos",
status_override="passed",
entries=[],
entries=[
{"type": "RawAssertion", "passed": True},
],
),
TestCaseReport(
name="NegativeNos",
status_override="passed",
entries=[],
entries=[
{"type": "RawAssertion", "passed": True},
],
),
],
),
Expand All @@ -29,13 +31,25 @@
entries=[
TestCaseReport(
name="PositiveNos",
status_override="passed",
entries=[],
entries=[
{"type": "RawAssertion", "passed": True},
],
),
TestCaseReport(
name="NegativeNos",
status_override="passed",
entries=[],
entries=[
{"type": "RawAssertion", "passed": True},
],
),
],
),
TestGroupReport(
name="ProcessChecks",
category="testsuite",
entries=[
TestCaseReport(
name="ExitCodeCheck",
entries=[{"type": "RawAssertion", "passed": True}],
),
],
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,16 @@
],
tags=None,
),
TestGroupReport(
name="ProcessChecks",
category="testsuite",
entries=[
TestCaseReport(
name="ExitCodeCheck",
entries=[{"type": "RawAssertion", "passed": True}],
),
],
),
],
tags=None,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,16 @@
],
tags=None,
),
TestGroupReport(
name="ProcessChecks",
category="testsuite",
entries=[
TestCaseReport(
name="ExitCodeCheck",
entries=[{"type": "RawAssertion", "passed": True}],
),
],
),
],
tags=None,
)
Expand Down

0 comments on commit dbb2617

Please sign in to comment.