allure-python: pytest-bdd 5.0.0: error on generating report with failed tests with scenario outlines

I’m submitting a …

  • [V] bug report
  • [V] feature request

What is the current behavior?

report doesn’t include failed tests with scenario outline (pytest-bdd 5.0.0) it fails with com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of java.lang.String out of START_OBJECT token

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

  1. pytest-bdd 5.0.0
  2. run scenario outlines with examples which fails
  3. generate report

What is the expected behavior?

failed tests appears in report

Please tell us about your environment:

  • Test framework: pytest-bdd@5.0.0
  • Allure adaptor: allure-pytest-bdd@2.9.45 (and other lower versions)

Other information

it worked OK with previous pytest-bdd versions

pytest-bdd 5.0.0 changes https://pytest-bdd.readthedocs.io/en/latest/#id1

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 23 (5 by maintainers)

Commits related to this issue

Most upvoted comments

I have workaround for this issue. Following code should be placed in conftest.py:

from allure_commons.lifecycle import AllureLifecycle
from allure_commons.model2 import TestResult
from allure_commons import plugin_manager

def custom_write_test_case(self, uuid=None):
    test_result = self._pop_item(uuid=uuid, item_type=TestResult)
    if test_result:
        if test_result.parameters:
            adj_parameters = []
            for param in test_result.parameters:
                if param.name != '_pytest_bdd_example':
                    # do not include parameters with "_pytest_bdd_example"
                    adj_parameters.append(param)
            test_result.parameters = adj_parameters

        plugin_manager.hook.report_result(result=test_result)

AllureLifecycle.write_test_case = custom_write_test_case

I’ve come across the same issue, it fails to generate the report even for successful tests when using Scenario Outline.

com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type `java.lang.String` from Object value (token `JsonToken.START_OBJECT`)
 at [Source: (sun.nio.ch.ChannelInputStream); line: 1, column: 855] (through reference chain: io.qameta.allure.model.TestResult["parameters"]->java.util.ArrayList[0]->io.qameta.allure.model.Parameter["value"])
	at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59)

@robbrad Hi! Sorry for the delay. The fix just got released. Check v2.13.0!

I’m having exactly the same issue, but using pytest-bdd==6.0.0

Same issue, when this change will be available please