Comments (13)
I have a WIP using the pytest-reportportal
plugin. This allows us to use the --reportportal
CLI option to post our results to the configured report portal instance. This configuration is done in pytest.ini
at the moment, but we most likely want to determine a more secure place to pull our configuration from instead of having it in plain text.
Example execution:
pytest tests/test_pytest.py --reportportal --rp-launch MyLaunchName --rp-launch-desc "An example launch description"
What this will look like in report portal:
Test cases for each test file executed:
Test case per function/method level test in the file:
Details on test cases including logs for errors/failures:
One caveat here is that we are stuck installing the reportportal-client
dependency from the master
branch of their github repo because they haven't published an actual release to pypi with code that this working version of pytest-reportportal
depends on. This is pretty easy to do and will look like this in our setup.py:
install_requires=[
...
'reportportal-client @ git+https://github.com/reportportal/client-Python.git@master',
'pytest-reportportal==1.0.5',
],
This solution also requires us to update pip to support this syntax so I will be adding the following to our getting started documentation, after creating the virtual environment:
pip install --upgrade pip
If this approach is sufficient for us I can get clean this up and add to our documentation to support it. If there is some functionality we might be missing here let's talk about it and figure out what needs to be done to meet our needs.
from ocs-ci.
@clacroix12 assigning this to you? Ideally we want the pypi method to import the module and use it?
from ocs-ci.
@petr-balogh do you have links to what RHV has done on this front?
from ocs-ci.
@clacroix12 in rhevm we used something like this: https://github.com/tareqalayan/reportportal_cli this is just fork from CNV team. It's executed after the execution of pytest so not part of run of pytest itself. Like publisher in the jenkins job from xunit file and you can add the logs and so on. How CNV is calling it is implemented here
from ocs-ci.
@clacroix12 Nice!, I think we can push them to release a version in pypi and until then we can use the master branch like you suggested.
from ocs-ci.
Initial take at this is here: ecabeba
from ocs-ci.
This is great @clacroix12
from ocs-ci.
from ocs-ci.
@clacroix12 Speaking about linking to polarion test cases: Assuming that we are going to report the test run resutls via junit xml report (as generated by pytest), it seems to me that we need to find a way for a polarion test case will be referenced there.
There are few options which pytest provides here, like:
- https://docs.pytest.org/en/latest/usage.html#record-property
- https://docs.pytest.org/en/latest/usage.html#record-xml-attribute
- https://docs.pytest.org/en/latest/usage.html#record-testsuite-property
This means we could just use the fixture in the test code, or establish a convention along with ytest_collection_modifyitems hook for test markers for the same purpose.
What would you prefer? If I recall right, some of these fixtures were implemented by cloud forms qe team to get their test results importable to polarion.
from ocs-ci.
@mbukatov I think the record property is the cleanest solution for us. Specifically implementing it with a custom marker for the Polarion ID. Once it is a property on the Test Case we can do whatever we want with it from the reporting side, correct?
# content of conftest.py
def pytest_collection_modifyitems(session, config, items):
for item in items:
for marker in item.iter_markers(name="polarion_id"):
polarion_id = marker.args[0]
item.user_properties.append(("polarion_id", polarion_id))
# content of test_function.py
import pytest
@pytest.mark.polarion_id(1234)
def test_function():
assert True
from ocs-ci.
@clacroix12 I agree using marker (as shown in your example) is the best approach. It also allow us to switch from property to xml attribute (or vice versa) without changing any test if CI updates requires it later.
The question whether to use properties (as you notes in the example) or record-xml attribute boils down to the needs of our CI pipeline and consumers of the junit xml file used there. So you, @petr-balogh , @dahorak and other CI people probably need to reach a consensus here.
from ocs-ci.
from ocs-ci.
Closing as #149 and #243 are complete. Any subsequent issues or enhancements around reporting can be raised in their own issues.
from ocs-ci.
Related Issues (20)
- [IBM Z] - Many tests are failing as `apt update` fails on nginx image HOT 8
- [RDR] Regression in Deployment: Investigate Recent PR Merges
- RDR tests fails with AttributeError: 'MultiClusterConfig' object has no attribute 'MULTICLUSER' HOT 1
- ocs-build --image --ocs-version 4.16 failing on TagNotFoundException: Couldn't find any desired tag HOT 2
- test_monitoring_shutdown_mgr_pod is failing on 4.14 with TypeError HOT 1
- openshift-install gather bootstrap doesn't work for fips enabled deployment
- In the test "test_check_pods_status_after_node_failure" we need to modify the condition of waiting for change in the pods status
- Test test_verify_rwo_using_replicated_pod failing with TimeoutExpiredError on compact mode cluster.
- The compare_dicts function failed due to a NoneType value being passed in the argument instead of a dict.
- RDR deployment fails during submariner installation
- Increase retry count for "test_mcg_data_deduplication"
- AWS UPI FIPS deployment failure HOT 1
- implementation of `get_random_files` contains the use of constants.OPENSHIFT_STORAGE_NAMESPACE which result in failuer of test case where custom namspace is used
- Azure deployment failing
- AWS infra node deployment complains about non existing securityGroup HOT 1
- modify_csv() feature from #2493 no longer working because of #4647 etc.
- Test case test_storage_cluster_validation_ui Failed with use of custom namespace because of use of hardcoded openshift-storage namespace
- test_dashboard_validation_ui test and test_odf_storagesystems_ui uses the base class where hardcoaded value as openshift-storage for project which is now not suitable on platform where custom namespace is used
- Need to Fix test_ocs_operator_is_not_present for utilising custome namespace as per plaform.
- Jenkins app workload is failing on UnexpectedBehaviour HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ocs-ci.