allure reports for #python #behave #BDD

In the last article I talked about pytest-AllureReports. As an extention to reporting, here we will talk about generating Allure reports for behave BDD framework for python

Step 1:
pip install allure-behave

Step 2:
Inside your framework root directory create a folder called "reports"


Step 3:
root directory
cmd > behave -f allure_behave.formatter:AllureFormatter -o D:\path....\reports  features\first_selenium.feature"



 This will generate json files inside the reports folder

Step 4: Navigate the commandline to reports directory and
cmd >
allure generate --clean -o "E:\path..\reports" "E:\path...\reports-JsonFiles"



 or
allure generate --clean -o E:\path...\reports E:\path...\reports-JsonFiles
Whichever works.
Basically
allure generate "clean the folder output directory" output directory is "output directory" "json files directory"

Comments

  1. Hi,
    When I try Step 4.. I get the following error...
    I get
    'allure' is not recognized as an internal or external command, operable program or batch file.

    I'm on Windows 7.

    Could you tell what I am doing wrong?
    Thanks
    kannan

    ReplyDelete
    Replies
    1. Apologies for the late response. You can check the responses here
      https://github.com/baev/allure-cli-depricated/issues/20
      Has to to with the placement of allure .bat file

      Delete
  2. I am on ubuntu 18 and getting allure command is not found. Also could not find .bat or bin(folder) in .local/lib/python3.6/site-packages. Do I need to install allure commandline separately?

    ReplyDelete
    Replies
    1. https://github.com/baev/allure-cli-depricated/releases/tag/allure-cli-2.4

      Delete
  3. I am on ubuntu 18 and getting allure command is not found. Also could not find .bat or bin(folder) in .local/lib/python3.6/site-packages. Do I need to install allure commandline separately?

    ReplyDelete
  4. Hi,
    when I run the last command to generate html report, i got allure-results does not exists with Report successfully generated to C:\p4client\Automation\main_branch\Features\allure-results
    the generated html page is filled with zeros

    ReplyDelete
  5. Hello, I want to update report name and report title, can you help me to find a solution? Thank you.

    ReplyDelete
  6. Wow this is really amazing post. Thanks for sharing the useful informative data. I appreciate your difficulty work. Keep blogging. Protractor Training in Electronic City

    ReplyDelete
  7. Where will we find allure.bat (may be allure.sh ) for mac system ? I am using allure-behave python framework

    ReplyDelete
  8. Hi, Can you please share the allure.bat file and where we need to place the file. It will be very helpful.

    ReplyDelete
    Replies
    1. https://github.com/baev/allure-cli-depricated/releases/tag/allure-cli-2.4

      Delete
  9. Hi,

    Is there any sample code which can store the Rest Response in allure report

    ReplyDelete
    Replies
    1. import csv
      import requests
      import pytest
      import allure

      def read_test_data_from_csv():
      test_data = []
      with open('./gpv.csv', newline='') as csvfile:
      data = csv.reader(csvfile, delimiter=',')
      for row in data:
      test_data.append(row)
      return test_data


      @pytest.mark.parametrize('path', read_test_data_from_csv())
      def test_gpv(path):
      base_url = 'http://10.10.10.10:8181'
      headers = {'accept': 'application/json', 'Content-type': 'application/json'}
      auth = ('admin', 'admin')
      endpoint = f'{base_url}{path[0]}'
      #print(f'Endpoint: {endpoint}')
      response = requests.get(endpoint, auth=auth, headers=headers)
      body = response.content
      #data = response.text
      assert response.status_code == 200

      Delete
    2. Wow this is really amazing post. Thanks for sharing the useful informative data.Keep blogging.
      software testing course in chennai

      Delete
    3. HI, Could you please let me know how you guys including request and response in allure report under each step..Thank you for your response

      Delete
  10. i am on window 10, installed allure-behave,

    getting error

    D:\BDD_Python_CourseMaterial\examples\scenario_outline>behave -f allure_behave.formatter
    usage: behave [options] [ [DIR|FILE|FILE:LINE] ]+
    behave: error: format=allure_behave.formatter is unknown

    ReplyDelete
  11. This is an amazing blog, thank you so much for sharing such valuable information with us.
    Visit us: Online Ui Path Training
    Visit us: RPA Online Training

    ReplyDelete

Post a Comment

Popular Posts