question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:12

github_iconTop GitHub Comments

6reactions
olerudyshyncommented, Aug 1, 2022

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
5reactions
andronikosnedos-temboocommented, Dec 8, 2021

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)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Welcome to Pytest-BDD's documentation! - Read the Docs
The significant downside of combining scenario outline and pytest parametrization approach was an inability to see the test table from the feature file....
Read more >
Pytest-BDD Documentation - Read the Docs
Refuse combining scenario outline and pytest parametrization ... 5.0.0 ... It's important to have nice reporting out of your bdd tests.
Read more >
pytest-bdd - PyPI
pytest -bdd implements a subset of Gherkin language for the automation of the project requirements testing and easier behavioral driven development.
Read more >
Generate allure report using pytest-bdd not showing anything
This issue occurs when you have all of your features with Scenario Outlines(Using Example Table) instead of Scenarios.
Read more >
Plugin List — pytest documentation
name summary last release status requi... pytest‑accept A pytest‑plugin for updating doctest outputs Jan 07, 2022 N/A pytes... pytest‑addons‑test 用于测试pytest的插件 Aug 02, 2021 N/A pytes... pytest‑aio...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found