jeudi 26 mars 2020

Adding console output into cucumber html report

I have helper method.rb file which is under features/util/service/ directory. This helper class' methods are logging information into the console by puts method during the test execution.

The problem is that the logs in the helper class are not shown in the cucumber HTML report. However, the logs in the features/step_definitions/ directory are shown in the cucumber HTML report.

The question is, how to add log information which is logging by puts command under cucumber default /feature directory into the cucumber HTML report?

Example console logs which I copied from the IDE. I just want to see logs from service_post requested url to current_balance: 403338.07.

/usr/local/lib/ruby/gems/2.6.0/bin/bundle exec /usr/local/opt/ruby/bin/ruby -EUTF-8 /usr/local/lib/ruby/gems/2.6.0/bin/cucumber /Documents/projects/test-automation/features/test/homepage/login.feature --format Teamcity::Cucumber::Formatter --expand --name "^Successful login and logout$" --color -r features
including Capybara::DSL in the global scope is not recommended!
WARNING: The formatter Teamcity::Cucumber::Formatter is using the deprecated formatter API which will be removed in v4.0 of Cucumber.


Scenario running: Successful login and logout

Visiting url: http://url.com
service_post requested url: http://api/login/internal
service_post posted request body: {"username":"uname","password":"pass"}
service_post posted request header: {"Content-Type"=>"application/json"}
ldap_cookie: auth_cookie=nCzG...
User current_balance: 403338.07
Tags: @@done, @@smoke

Logging Seller ==> Username: e... ==> Cookie: auth_cookie=tBDU...

PASSED ==> Feature: Homepage login scenarios => Scenario: Successful_login_and_logout

[INFO] - [2020-03-26 14:45:38 +0300] - visit homepage
[INFO] - [2020-03-26 14:45:48 +0300] - login
[INFO] - [2020-03-26 14:45:54 +0300] - logout
1 scenario (1 passed)
3 steps (3 passed)
0m22.309s
Process finished with exit code 0

Example report

Aucun commentaire:

Enregistrer un commentaire