allure-python icon indicating copy to clipboard operation
allure-python copied to clipboard

allure.issue and allure.testcase require both url and name params contradicting documentation

Open jurisbu opened this issue 8 years ago • 10 comments

I'm submitting a ...

  • [x] bug report
  • [ ] feature request
  • [ ] support request => Please do not submit support request here, see note at the top of this template.

What is the current behavior?

Implementation of allure.issue and allure.testcase decorators in pytest-allure-adaptor only required one argument e.g. the URL or name of test/issue.

In allure-pytest this behavior has changed and now requires both arguments url and name supplied. On top of that name argument from function declaration seems to be optional which is not entirely true.

def testcase(url, name=None):
    return link(url, link_type=LinkType.TEST_CASE, name=name)

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

Non-working example with allure-pytest (works fine with pytest-allure-adaptor)

import allure

@allure.issue('http://localhost/JIRA-001')
@allure.testcase('http://localhost/TC-001')
def test_first():
    pass

Resulting report has missing issue and testcase links in report Links section.

What is the expected behavior?

Issue and test case links are available in report as specified in decorators.

What is the motivation / use case for changing the behavior?

As I see it there are 2 options to approach this:

  1. If the new behavior was intended then this has to be documented and name argument should be made mandatory.

  2. Change behavior to match what is docuemnted and matches behavior in pytest-allure-adaptor.

Please tell us about your environment:

Other information

jurisbu avatar Nov 08 '17 13:11 jurisbu

Can not reproduce.

@allure.testcase(TEST_CASE)
def test_single_test_case():
    """
    >>> allure_report = getfixture('allure_report')
    >>> assert_that(allure_report,
    ...             has_test_case('test_single_test_case',
    ...                 has_test_case_link(TEST_CASE)
    ...             ))
    """
    pass
    "name": "test_single_test_case", 
    "links": [
        {
            "url": "https://github.com/qameta/allure-integrations/issues/8#issuecomment-268313637", 
            "type": "test_case"
        }
    ], 

Fill free to reopen this issue with additional information.

sseliverstov avatar Jan 11 '18 19:01 sseliverstov

@sseliverstov Not sure how you can say you are not able to reproduce if you did not even try my example.

So here are the grandma instructions on how to reproduce the issue step by step.

# Create clean virtualenv
$  python3 -m venv allure_venv
$ . allure_venv/bin/activate

# Install packages (bare minimum, just pytest and allure-pytest)
$ pip install pytest
$ pip install allure-pytest
$ pip freeze
allure-pytest==2.3.1b1
allure-python-commons==2.3.1b1
attrs==17.4.0
enum34==1.1.6
pkg-resources==0.0.0
pluggy==0.6.0
py==1.5.2
pytest==3.3.2

# Create example test file
$ cat > test_allure_issue.py << EOF
import allure

@allure.issue('http://localhost/JIRA-001')
@allure.testcase('http://localhost/TC-001')
def test_first():
    pass
EOF

# Run test
$ pytest --alluredir=allure-results -v test_allure_issue.py

# Allure results
$ allure serve

jurisbu avatar Jan 16 '18 16:01 jurisbu

Attaching screenshot of generated report where it is clearly visible that links are missing. screenshot from 2018-01-16 17-55-46

jurisbu avatar Jan 16 '18 16:01 jurisbu

Hi! Can you show json result file for 'test_first'?

sseliverstov avatar Jan 16 '18 18:01 sseliverstov

JFYI https://github.com/allure-framework/allure2/issues/473

sseliverstov avatar Jan 16 '18 18:01 sseliverstov

Hi! Can you show json result file for 'test_first'?

{
  "status": "passed",
  "name": "test_first",
  "historyId": "a25eff06ab40fca4773261e40c06c6bc",
  "uuid": "e09764e7-c608-47b7-8423-85b226549183",
  "stop": 1516118520208,
  "links": [
    {
      "url": "http://localhost/JIRA-001",
      "type": "issue"
    },
    {
      "url": "http://localhost/TC-001",
      "type": "test_case"
    }
  ],
  "fullName": "test_allure_issue#test_first",
  "start": 1516118520208,
  "labels": [
    {
      "value": "darkhorse",
      "name": "host"
    },
    {
      "value": "23532-MainThread",
      "name": "thread"
    },
    {
      "value": "pytest",
      "name": "framework"
    },
    {
      "value": "cpython3",
      "name": "language"
    },
    {
      "value": "test_allure_issue",
      "name": "package"
    }
  ]
}

jurisbu avatar Jan 17 '18 08:01 jurisbu

Hi!

Any progress on this? It looks like a fix is as trivial as adding check if just argument passed then name = url. Please correct me if there are some hidden complexities.

Kreisfahrer avatar Jul 30 '18 14:07 Kreisfahrer

Will this be fixed at some point of time?

goranpetrovikj avatar Jan 15 '19 09:01 goranpetrovikj

FYI: https://github.com/allure-framework/allure-python/pull/365

samuraii avatar Mar 26 '19 16:03 samuraii

Can be closed I guess

Denis-Alexeev avatar Oct 01 '21 15:10 Denis-Alexeev

Fixed in #365

delatrie avatar Dec 12 '22 08:12 delatrie