--format 및 --outfile 매개 변수를 사용하여 동작 코드를 실행할 수 있으며 예상대로 작동합니다.python에서 출력 및 형식 설정, 특히 environment.py
behave 00-test.feature --format json --outfile "C:/results.json"
결과는 C : /results.json의 json 형식으로 표시됩니다.
behave.ini와 명령 줄을 통해 이러한 변수를 전달하지 않으려합니다. 나는 그래서 단순히 어디에서 다음 실행할 수 enviroment.py에서 그 변수를 설정하려면 다음 environment.py 파일 내에서
behave 00-test.feature
, 나는 내가 생각할 수있는 모든 조합을 시도하고 그들은 모두 내려 이 세 가지 변수는 있지만 행운은 없습니다.
def before_all(context):
...
context.config.outfiles = ["C:/results.json"]
context.config.outputs = [StreamOpener("C:/results.json")]
context.config.formatters = ['json']
...
왜 StreamOpener인가? https://github.com/behave/behave/blob/master/behave/configuration.py 은 outputs가 StreamOpener 객체의 목록임을 보여줍니다.
누구나 python-behave에서 outfiles 및 formatters를 설정하는 적절한 방법을 알고 있습니까?