0

Part of my test is to print some statements in command line.

I followed steps which mentioned here: How can I see print() statements in behave (BDD)

However, I’m not able to see the print() statement from last line of my code.

I ran test_bdd.feature --no-capture on command line and the result:

Feature: Learning BDD # test_bdd.feature:1

  Scenario: Cooking test       # test_bdd.feature:3
    Given I am hungry          # steps/test_bdd.py:3 0.000s
    When my mother is shopping # steps/test_bdd.py:7 0.000s
    Then I cook a meal         # steps/test_bdd.py:11
print debug #1
print debug #2
    Then I cook a meal         # steps/test_bdd.py:11 0.000s

1 feature passed, 0 failed, 0 skipped
1 scenario passed, 0 failed, 0 skipped
3 steps passed, 0 failed, 0 skipped, 0 undefined
Took 0m0.001s

^ No print debug #3 showed up in the result. Is there a way to show this part on command line?

My test_bdd.feature :

Feature: Learning BDD

  Scenario: Cooking test
    Given I am hungry
    When my mother is shopping
    Then I cook a meal

My test_bdd.py :

from behave import *
from selenium import webdriver
@given("I am hungry")
def step_impl(context):
    pass

@when("my mother is shopping")
def step_impl(context):
    pass

@then("I cook a meal")
def step_impl(context):
    print ("print debug #1")
    print ("print debug #2")
    print ("print debug #3")  # this line is not printed

I used python-behave version: behave 1.2.5

Community
  • 1
  • 1
Raja David
  • 304
  • 7
  • 16
  • I've updated the question you link to with a new answer. I'm sure that what you are experiencing is what I describe in my answer. Once you've ascertained that this is the case make sure to accept the prompt you get from the site about whether your question has been answered so it can be closed as a duplicate. Or if what I wrote is definitely not the problem, you should edit your question here and update it with what you've done to determine that.Thank you. – Louis Jan 31 '17 at 23:11
  • @Louis: Hello, your answer in [How can I see print() statements in behave (BDD)](http://stackoverflow.com/questions/25150404/how-can-i-see-print-statements-in-behave-bdd) is what I'm looking for. I marked this question as duplicate. Thank you, Louis. – Raja David Feb 03 '17 at 11:20

0 Answers0