Jessica Posted May 10, 2013 Share Posted May 10, 2013 Using behat to run some tests - if I add an echo within a step, or echo in my afterStep() function, I don't get the message until all the steps are done running (so if afterStep() has echo 'test'; at the end I get testtesttestest etc.) I can't find anything on google about this, I see examples where people are doing an echo within their steps, but I can't get it to work. Any ideas? Quote Link to comment Share on other sites More sharing options...
Mad programmer Posted May 10, 2013 Share Posted May 10, 2013 Hi Jessica,I am not familiar with behat, but maybe it uses output buffering internally?So I'd try to catch the output buffer and end it, after that you echo your content and then reenable the output buffer with that content? Quote Link to comment Share on other sites More sharing options...
Adam Posted May 10, 2013 Share Posted May 10, 2013 Just curious, why are you wanting to echo from an automated test? By nature they shouldn't fail, except during the initial development or after changes, but in those cases at the end is surely fine? Quote Link to comment Share on other sites More sharing options...
Jessica Posted May 10, 2013 Author Share Posted May 10, 2013 For a few reasons - one is that one of our steps involves checking an email account to see if the email was recieved. The step automatically waits 30 seconds. However it doesn't output to the screen that it's checking email until after it's passed or failed, so when we are manually running the tests and watching, it sits for 30 seconds with no output. We wanted to add a simple message that says "Waiting for 30 seconds before Checking Email". Quote Link to comment Share on other sites More sharing options...
Adam Posted May 13, 2013 Share Posted May 13, 2013 Why do you need to physically send the email? Just mock the mailer and ensure it receives what it should. Otherwise your tests are dependant on some outside system that could fail for reasons completely unrelated to your code, which will screw up the CI environment for no reason. There should be other checks in place to spot issues with the network. Plus, as your test suite grows, you don't want 30 seconds waits dotted around, it will take forever to run them all. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.