bdd - Ambiguous step in Python Behave -
my business user likes use sentence "it should created", determined context of scenario. example:
given have gift certificate "<name>" when enter gift certificate should created
or
given customer order return order "<order_no>" when create customer order return should created
in "then should created", retrieve either created gift certificate or customer order return comparison. however, have different api , object.
firstly, there way in python behave without getting "exception ambiguousstep:"?
if not, best practice in bdd world without forcing user have repeat saying "then gift certificate should created" or "then customer order return should created"?
thanks.
in specific case giving here, write steps more verbosely avoid "it". write "then gift certificate should created", etc. prefer avoid having steps depend on state passed through context
.
however...
there times problematic this. in case, maybe politics of dealing business user make asking more verbosity not fly well. or there can technical reasons cause suggested above undesirable or flat out unworkable.
what can if cannot use more verbose steps, have then should created
step dependent on context
field being set value provide enough information step perform work. context.created_object
. step creates object set field appropriate value then should created
can perform work. store in there depends on specifics of application.
for 1 application of mine test appearance of contextual menu on basis of mouse clicks in browser window, record reference dom element on user did right-click brought menu. object providing x, y coordinates. application needs in order perform checks. in case preferable have information passed through context
because having selenium query dom on again in later steps can expensive on network. on dozens of tests, can add minutes test suite's run, , consider suite has run multiple combinations of browser, os, , browser version.
Comments
Post a Comment