Skip to content

Commit

Permalink
Merge pull request #11 from ryan-rs/feature/ASC-394/update_for_new_re…
Browse files Browse the repository at this point in the history
…sults_hierarchy

ASC-394 Update to Comply with New Results Hierarchy
  • Loading branch information
zreichert authored Apr 19, 2018
2 parents e7c75fb + 83094a4 commit d87c3d5
Show file tree
Hide file tree
Showing 8 changed files with 175 additions and 137 deletions.
10 changes: 9 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ Quick Start Guide

1. Install ``zigzag`` from PyPI with pip::

$ pip install --process-dependency-links rpc-zigzag
$ pip install -e git+git://github.com/ryan-rs/qtest-swagger-client.git@master#egg=swagger-client-1.0.0
$ pip install rpc-zigzag

2. For more information on using the Zigzag launch help by::

Expand All @@ -27,6 +28,13 @@ Quick Start Guide

4. Checkout QA Symphony's website for more details on configuring `qTest Manager API`_ access.

Choosing a Parent Test Cycle
----------------------------

The intended parent test cycle should be one that is named after the product release code name. (e.g. Queens) It is
assumed that this test cycle was created beforehand. By using a test cycle with a product release code name the
resulting execution result hierarchy will group results in a sensible manner.

Contributing
------------

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ tox
pytest
pytest-cov
pytest-mock
pytest-helpers-namespace
ipython
pytest-rpc
-e git+https://github.com/ryan-rs/qtest-swagger-client.git@master#egg=swagger-client-1.0.0
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.6.1
current_version = 0.7.0
commit = false
tag = false

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

setup(
name='rpc-zigzag',
version='0.6.1',
version='0.7.0',
author="rcbops",
author_email='[email protected]',
maintainer='rcbops',
Expand Down
137 changes: 73 additions & 64 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,29 @@
# Imports
# ======================================================================================================================
import pytest

pytest_plugins = ['helpers_namespace']

# ======================================================================================================================
# Globals
# ======================================================================================================================
DEFAULT_GLOBAL_PROPERTIES = \
"""
<properties>
<property name="BUILD_URL" value="Unknown"/>
<property name="BUILD_NUMBER" value="Unknown"/>
<property name="RE_JOB_ACTION" value="Unknown"/>
<property name="RE_JOB_IMAGE" value="Unknown"/>
<property name="RE_JOB_SCENARIO" value="Unknown"/>
<property name="RE_JOB_BRANCH" value="Unknown"/>
<property name="RPC_RELEASE" value="Unknown"/>
<property name="RPC_PRODUCT_RELEASE" value="Unknown"/>
<property name="OS_ARTIFACT_SHA" value="Unknown"/>
<property name="PYTHON_ARTIFACT_SHA" value="Unknown"/>
<property name="APT_ARTIFACT_SHA" value="Unknown"/>
<property name="REPO_URL" value="Unknown"/>
<property name="BUILD_URL" value="BUILD_URL"/>
<property name="BUILD_NUMBER" value="BUILD_NUMBER"/>
<property name="RE_JOB_ACTION" value="RE_JOB_ACTION"/>
<property name="RE_JOB_IMAGE" value="RE_JOB_IMAGE"/>
<property name="RE_JOB_SCENARIO" value="RE_JOB_SCENARIO"/>
<property name="RE_JOB_BRANCH" value="RE_JOB_BRANCH"/>
<property name="RPC_RELEASE" value="RPC_RELEASE"/>
<property name="RPC_PRODUCT_RELEASE" value="RPC_PRODUCT_RELEASE"/>
<property name="OS_ARTIFACT_SHA" value="OS_ARTIFACT_SHA"/>
<property name="PYTHON_ARTIFACT_SHA" value="PYTHON_ARTIFACT_SHA"/>
<property name="APT_ARTIFACT_SHA" value="APT_ARTIFACT_SHA"/>
<property name="REPO_URL" value="REPO_URL"/>
<property name="JOB_NAME" value="JOB_NAME"/>
<property name="MOLECULE_TEST_REPO" value="MOLECULE_TEST_REPO"/>
<property name="MOLECULE_SCENARIO_NAME" value="MOLECULE_SCENARIO_NAME"/>
</properties>
"""

Expand All @@ -37,6 +40,28 @@
"""


# ======================================================================================================================
# Helpers
# ======================================================================================================================
# noinspection PyUnresolvedReferences
@pytest.helpers.register
def merge_dicts(*args):
"""Given any number of dicts, shallow copy and merge into a new dict, precedence goes to key value pairs in latter
dicts.
Args:
*args (list(dict)): A list of dictionaries to be merged.
Returns:
dict: A merged dictionary.
"""

result = {}
for dictionary in args:
result.update(dictionary)
return result


# ======================================================================================================================
# Fixtures
# ======================================================================================================================
Expand Down Expand Up @@ -185,47 +210,33 @@ def flat_all_passing_xml(tmpdir_factory):


@pytest.fixture(scope='session')
def flat_mix_status_xml(tmpdir_factory):
"""JUnitXML sample representing mixed status for multiple test cases."""
def suite_all_passing_xml(tmpdir_factory):
"""JUnitXML sample representing multiple passing test cases in a test suite. (Tests within a Python class)"""

filename = tmpdir_factory.mktemp('data').join('flat_mix_status.xml').strpath
filename = tmpdir_factory.mktemp('data').join('suite_all_passing.xml').strpath
junit_xml = \
"""<?xml version="1.0" encoding="utf-8"?>
<testsuite errors="1" failures="1" name="pytest" skips="1" tests="4" time="1.901">
<testsuite errors="0" failures="0" name="pytest" skips="0" tests="5" time="1.664">
{global_properties}
<testcase classname="tests.test_default" file="tests/test_default.py" line="12"
name="test_pass[ansible://localhost]" time="0.0034921169281">
<testcase classname="tests.test_default.TestSuite" file="tests/test_default.py" line="8"
name="test_pass1[ansible://localhost]" time="0.00372695922852">
{testcase_properties}
</testcase>
<testcase classname="tests.test_default" file="tests/test_default.py" line="16"
name="test_fail[ansible://localhost]" time="0.00335693359375">
<testcase classname="tests.test_default.TestSuite" file="tests/test_default.py" line="12"
name="test_pass2[ansible://localhost]" time="0.00341415405273">
{testcase_properties}
<failure message="assert False">host = &lt;testinfra.host.Host object at 0x7f0921d98cd0&gt;
def test_fail(host):
&gt; assert False
E assert False
tests/test_default.py:18: AssertionError</failure>
</testcase>
<testcase classname="tests.test_default" file="tests/test_default.py" line="20"
name="test_error[ansible://localhost]" time="0.00208067893982">
<testcase classname="tests.test_default.TestSuite" file="tests/test_default.py" line="15"
name="test_pass3[ansible://localhost]" time="0.00363945960999">
{testcase_properties}
<error message="test setup failure">host = &lt;testinfra.host.Host object at 0x7f0921d98cd0&gt;
@pytest.fixture
def error_fixture(host):
&gt; raise RuntimeError(&apos;oops&apos;)
E RuntimeError: oops
tests/test_default.py:10: RuntimeError</error>
</testcase>
<testcase classname="tests.test_default" file="tests/test_default.py" line="24"
name="test_skip[ansible://localhost]" time="0.00197100639343">
<testcase classname="tests.test_default.TestSuite" file="tests/test_default.py" line="18"
name="test_pass4[ansible://localhost]" time="0.00314617156982">
{testcase_properties}
</testcase>
<testcase classname="tests.test_default.TestSuite" file="tests/test_default.py" line="21"
name="test_pass5[ansible://localhost]" time="0.00332307815552">
{testcase_properties}
<skipped message="unconditional skip" type="pytest.skip">
tests/test_default.py:24: &lt;py._xmlgen.raw object at 0x7f0921ff4d50&gt;
</skipped>
</testcase>
</testsuite>
""".format(global_properties=DEFAULT_GLOBAL_PROPERTIES, testcase_properties=DEFAULT_TESTCASE_PROPERTIES)
Expand All @@ -237,48 +248,46 @@ def error_fixture(host):


@pytest.fixture(scope='session')
def suite_mix_status_xml(tmpdir_factory):
"""JUnitXML sample representing mixed status for multiple test cases in a test suite."""
def flat_mix_status_xml(tmpdir_factory):
"""JUnitXML sample representing mixed status for multiple test cases."""

filename = tmpdir_factory.mktemp('data').join('suite_mix_status.xml').strpath
filename = tmpdir_factory.mktemp('data').join('flat_mix_status.xml').strpath
junit_xml = \
"""<?xml version="1.0" encoding="utf-8"?>
<testsuite errors="1" failures="1" name="pytest" skips="1" tests="4" time="1.853">
<testsuite errors="1" failures="1" name="pytest" skips="1" tests="4" time="1.901">
{global_properties}
<testcase classname="tests.test_default.TestClass" file="tests/test_default.py" line="35"
name="test_pass[ansible://localhost]" time="0.00357985496521">
<testcase classname="tests.test_default" file="tests/test_default.py" line="12"
name="test_pass[ansible://localhost]" time="0.0034921169281">
{testcase_properties}
</testcase>
<testcase classname="tests.test_default.TestClass" file="tests/test_default.py" line="38"
name="test_fail[ansible://localhost]" time="0.00310778617859">
<testcase classname="tests.test_default" file="tests/test_default.py" line="16"
name="test_fail[ansible://localhost]" time="0.00335693359375">
{testcase_properties}
<failure message="assert False">self = &lt;test_default.TestClass object at 0x7fb9c7b9a790&gt;
host = &lt;testinfra.host.Host object at 0x7fb9c7c18d10&gt;
<failure message="assert False">host = &lt;testinfra.host.Host object at 0x7f0921d98cd0&gt;
def test_fail(self, host):
def test_fail(host):
&gt; assert False
E assert False
tests/test_default.py:40: AssertionError</failure>
tests/test_default.py:18: AssertionError</failure>
</testcase>
<testcase classname="tests.test_default.TestClass" file="tests/test_default.py" line="41"
name="test_error[ansible://localhost]" time="0.00223517417908">
<testcase classname="tests.test_default" file="tests/test_default.py" line="20"
name="test_error[ansible://localhost]" time="0.00208067893982">
{testcase_properties}
<error message="test setup failure">self = &lt;test_default.TestClass object at 0x7fb9cb5b7190&gt;
host = &lt;testinfra.host.Host object at 0x7fb9c7c18d10&gt;
<error message="test setup failure">host = &lt;testinfra.host.Host object at 0x7f0921d98cd0&gt;
@pytest.fixture
def error_fixture(self, host):
def error_fixture(host):
&gt; raise RuntimeError(&apos;oops&apos;)
E RuntimeError: oops
tests/test_default.py:34: RuntimeError</error>
tests/test_default.py:10: RuntimeError</error>
</testcase>
<testcase classname="tests.test_default.TestClass" file="tests/test_default.py" line="44"
name="test_skip[ansible://localhost]" time="0.00199604034424">
<testcase classname="tests.test_default" file="tests/test_default.py" line="24"
name="test_skip[ansible://localhost]" time="0.00197100639343">
{testcase_properties}
<skipped message="unconditional skip" type="pytest.skip">
tests/test_default.py:44: &lt;py._xmlgen.raw object at 0x7fb9c904d190&gt;
tests/test_default.py:24: &lt;py._xmlgen.raw object at 0x7f0921ff4d50&gt;
</skipped>
</testcase>
</testsuite>
Expand Down
Loading

0 comments on commit d87c3d5

Please sign in to comment.