2017-06-26 11 views
1

を印刷します。コンテキスト:私はBehave(BDD)を使用しています。シナリオ番号

@ISA-75 
@ISA-76 
@1 
@1.1 
Scenario: A user will be able to enter an email address to receive a notification when a requested archive is complete. 
    Given ... 
    When ... 
    Then ... 

@ 1または1.1情報@が含まれているdoesnの `tの実行の出力: マイ.featureファイルは次のように見えます。 実行時にその情報を表示するように振る舞うように指示する方法はありますか?

答えて

2

どのようにアサーションを作成しているかによって異なります。しかし、docsにある情報から実装することができます。私はhereのようにbehave.iniを設定してprintを表示し、これをenvironment.pyファイルに追加しました。

def after_scenario(context, scenario): 
    if context.failed == True: 
     print(context.scenario, 'failed. Here are the tags:') 
     for tag in context.tags: 
      print(tag) 

あなたのアサーションでtry/catchを使用し、例外の場合は最後の行を実行するだけの方法があります。