Using PyTest integrate with TestOps,how to configure and record some information into TestResult ?

Hi @didit,

Sorry for the late reply. Investigating your concern is taking a bit longer than expected. Regrettably, our logs do not provide any clues or error messages to help us. Could you please share your report files?

Also, please share your Python version and Pytest version. It will help us in finding out why the details of the results are not parsed.

Absolutely yes, @bionel. You can avail a free subscription of Katalon TestOps, which allows up to 2000 test results per month. You can get more information about subscriptions here.

It would be my honor if you could try it out and give us feedback.

Hi, I already tried, and yes, is fine.
Now, since you are here, can you bring some light into the actual topic?
You have no excuse now to pretend you didn’t saw this topic :smiley:

:smile: Sure, a team of elite warriors is ready for this topic, just wait for more input from @didit to continue investigating.

Hi @tri.tle thanks for investigating, I’m using python 3.12.0 and pytest 7.4.2

report files means result.json ?

Hi @bionel I think the code is here :

def pytest_sessionfinish(session: Session, exitstatus: Union[int, ExitCode]) -> None:
    """ End the test """
    try:
        logger.info(msg="Processing test result...")
        report_lifecycle.stop_execution()
        report_lifecycle.write_test_results_report()
        report_lifecycle.write_test_suites_report()
        report_lifecycle.write_execution_report()
        report_lifecycle.reset()
        logger.info(msg="Uploading report to TestOps...")
        report_lifecycle.upload()
        testsuites.clear()
    except Exception:
        _log_internal_error()

esp on

report_lifecycle.write_execution_report()

Later I’ll try to understand the code on testops_commons

This doesn’t tell much.
Can you show a sample code?
Also … can I ask … what is your level with python + pytest?
In order to solve this, first you have to get yourself familiar with pytest hooks, understand how they works and when are executed.
Seems like this plugin is using some standard hooks:
https://docs.pytest.org/en/7.1.x/reference/reference.html#hooks

After that, we have to understand how the under-the-hood libs in testops-common works, up to when the json reports are produced (prior to upload).
source seems to be here: GitHub - katalon-studio/testops-commons-python

To get a full understanding, we may have to abuse a bit the good old pdb

After that, we have to find a way to manipulate the data there … by importing a certain class maybe and manipulating a certain object before is ‘flushed’ to the report?
And we have to figure it out when to manipulate the reports and how (perhaps with a finalizer, or with an own hook added in conftest …) provided is possible. Otherwise we may have to patch the plugin himself.

And, the most important, we need to know what exactly to add in the json and here only “the team of elite warriors” @tri.tle can provide us the needed info (what data testops api expects to be present so this fields to be populated in UI … or if not possible, perhaps such can be uploaded/updated with some api calls …)

So, the issue raised by you is not trivial … but can be fun.

Hi @didit, it’s me again after two weeks. I apologize for the delay. I just received the results of the investigation, which indicate that logs are not supported for parsing from PyTest reports. Currently, for PyTest integration, we only support parsing error messages and error logs from reports.

I sincerely apologize for these limitations. However, please continue to provide us with your feedback, as it is extremely valuable to our product development.

kindly reply also to the full topic.
e. g. it is possible to ads such additional data through an post execution API call?
No matter about the framework used.
If yes, what is the endpoint to use and where is the API resource doc?
Or those fields are simply useless at this moment?
Cannot be parsed ATM, ok, but it is not the only way…