0

I am launching python-behave with command-line options like (tests outputs is being written to a logfile)

behave -f json -D browser=safari -D browser_version=8 -D platform=MAC features

I want to log which command-line options are being passed to behave in a logfile, but I cannot find how to do in a documentation. I tried using @capture with before_all hook in my environment.py (nothing new logged)

UPDATE: I need to log only -D options and include them inside relevant json output.

Does anyone know how to setup custom logging in behave? Thanks!

xsqox
  • 51
  • 1
  • 9

1 Answers1

0

Every options you set using the --define option are stored in the config of your context object, under userdata. To retrieve them all, you could use something like this:

for option, value in context.config.userdata.iteritems():

    # do something here

You weren't really specific as to how you want to output them here, but you may want to just print them out.

Verv
  • 2,385
  • 2
  • 23
  • 37