Search code examples
python-behave

How can we pass junit Behave command line arguments in .ini file


I am trying to replace --junit command line arguments in behave.ini file, other arguments like -D and format=plain are working fine. But --junit is not working for me, please find the command below,

behave --junit --junit-directory Reports/results

behave.ini/
[behave]
junit=True
junit-directory=Reports/results

Is there any way to resolve or is there any thing wrong ?

Thanks, Ranjith


Solution

  • Look at the behave.configuration module implementation and search for junit. The dest= attribute contains the python attribute name that is also used in the config-file. Dashes are normally replace by underscores. Therefore:

    ini # -- FILE: behave.ini
    [behave] 
    junit=True 
    junit_directory=Reports/results
    

    Reference

    Answer originally provided by jenisys in comments.