pythonallurepython-behavepytest-bdd

Allure Serve Got unexpected extra arguments


I'm trying to generate allure reports in my python - behave project.

I have my json files created in below directory structure.

Directory Structure

now I'm trying to execute

allure serve .\allure\results\

command seems like it's processing something for 5-6 seconds.but then returns below error

Usage: wb [OPTIONS] [DIR] Try 'wb --help' for help.

Error: Got unexpected extra arguments (: \ P y t h o n \ S c r i p t s \ . d i s t \ d r i v e r . z i p)

I looked it up for a while and now creating this topic. Meanwhile I'll also be looking what might be the problem.

Thanks for advance if you have a solution

Edit : So far I can see that the problem is in site-packages\allure\main.py and in function save_file

with open(archive_path, "wb") as code: code.write(file.content)

causing the problem, I'm not really sure what "wb" is here ?


Solution

  • Okay fixed the problem. Here I'm writing what was the problem and how I solve it in my own way.

    Description

    The problem was that basically my understanding about the system was a bit wrong. By the way coming from C# and JavaScript background, I had no prior experience about behave or allure it's been like 3 days since I started coding even in python after 9 years so excuse me for being a bit obviously false..

    Analysis

    So what I did is actually follow the 3 steps given in official page,

    $ pip install allure-behave

    $ behave -fallure_behave.formatter:AllureFormatter -o %allure_result_folder% ./features

    while this two was working correctly

    $ allure serve %allure_result_folder%

    above command at first was throwing me error below in terminal

    The term 'allure' is not recognized as the name of a cmdlet"

    So I installed this package,(just look it's name who wouldn't give it a try?)

    pip install allure-cmd

    when I install this package it actually started the throw the error where my question above created.

    Solution

    If you see that above I was code-tracing to understand what was going on and found. the variable called binary_path was looking for a .bat file where I didn't have installed in my computer.

    So then it hit me..

    Allure was another package should be running independently from my project just needs to get the output files in expected format then with Serve command it would start processing.So I installed allure seperately.

    Beware that my version of allure I installed is working in Java and you need to have Jre installed in your computer and in System Variables JAVA_HOME should be configured.

    You need to install Allure Commandline zip file of the latest version and also need to add bin file of the Allure directory into system path.

    Oh and please remove allure-cmd package from your python even you may consider reinstalling allure-behave since I saw that messes up some configuration causing step2 is not working.

    When you do above steps it should work in practice.

    Best Regards