Use teamcity cucumber formatter with not rake runner

Hello,

I would like to use teamcity cucumber formatter with command line.
The main reason for this is that i need to lauch cucumber tests through xvfb-run command.
My settings:
I set teamcity env.RUBYLIB with value %system.agent.home.dir%/plugins/rake-runner/rb/patch/common;%system.agent.home.dir%/plugins/rake-runner/rb/patch/bdd
Run tests with options --format TeamCity::Cucumber::Formatter -expand
Build fails with messages:
cannot load such file -- team_city/cucumber/formatter
Error creating formatter: TeamCity::Cucumber::Formatter (LoadError)

Any help?

Thanks in advance!

0
8 comments

Hi Andrey,

It's not documented and not supported, but you can use that approach.

Note semicolon (:) should be used to separate folders in RUBYLIB. (at least in unix)
Proper fomatter name is 'Teamcity::Cucumber::Formatter' (note 'c' in lower case)

BTW: Why don't you use rake-runner?
Also you can wrap running of all build steps using runas plugin. So you can configure your build as rake-runner step and runas feature to wrap all executions with xvfb-run.

Regards,
Vladislav.

0
Avatar
Permanently deleted user

Hello, Vladislav!

Thanks for reply.
I fixed RUBYLIB variable and formatter namespace, but i am still facing the same problem:

cannot load such file -- teamcity/cucumber/formatter
Error creating formatter: Teamcity::Cucumber::Formatter (LoadError)
/home/build/.rvm/gems/ruby-2.2.0/gems/cucumber-1.3.18/lib/cucumber/constantize.rb:17:in `require'
/home/build/.rvm/gems/ruby-2.2.0/gems/cucumber-1.3.18/lib/cucumber/constantize.rb:17:in `rescue in constantize'
/home/build/.rvm/gems/ruby-2.2.0/gems/cucumber-1.3.18/lib/cucumber/constantize.rb:6:in `constantize'
/home/build/.rvm/gems/ruby-2.2.0/gems/cucumber-1.3.18/lib/cucumber/cli/configuration.rb:83:in `formatter_class'
/home/build/.rvm/gems/ruby-2.2.0/gems/cucumber-1.3.18/lib/cucumber/cli/configuration.rb:182:in `block in formatters'
/home/build/.rvm/gems/ruby-2.2.0/gems/cucumber-1.3.18/lib/cucumber/cli/configuration.rb:178:in `map'
/home/build/.rvm/gems/ruby-2.2.0/gems/cucumber-1.3.18/lib/cucumber/cli/configuration.rb:178:in `formatters'
/home/build/.rvm/gems/ruby-2.2.0/gems/cucumber-1.3.18/lib/cucumber/cli/configuration.rb:76:in `build_tree_walker'
/home/build/.rvm/gems/ruby-2.2.0/gems/cucumber-1.3.18/lib/cucumber/runtime.rb:46:in `run!'
/home/build/.rvm/gems/ruby-2.2.0/gems/cucumber-1.3.18/lib/cucumber/cli/main.rb:47:in `execute!'
/home/build/.rvm/gems/ruby-2.2.0/gems/cucumber-1.3.18/bin/cucumber:13:in `<top (required)>'
/home/build/.rvm/gems/ruby-2.2.0/bin/cucumber:23:in `load'
/home/build/.rvm/gems/ruby-2.2.0/bin/cucumber:23:in `<main>'
/home/build/.rvm/gems/ruby-2.2.0/bin/ruby_executable_hooks:15:in `eval'
/home/build/.rvm/gems/ruby-2.2.0/bin/ruby_executable_hooks:15:in `<main>'


The command line i ran is 'xvfb-run bundle exec cucumber --expand --format Teamcity::Cucumber::Formatter'

I will try the solution with rake runner you suggested and will write results here.

Thanks!
0
Avatar
Permanently deleted user

I ran command line: xvfb-run bundle exec cucumber --expand --format Teamcity::Cucumber::Formatter --require %system.agent.home.dir%/plugins/rake-runner/rb/patch/bdd
And got the another error:

cannot load such file -- teamcity/runner_common (LoadError)
/home/build/BuildAgent/plugins/rake-runner/rb/patch/bdd/teamcity/cucumber/common.rb:18:in `require'
/home/build/BuildAgent/plugins/rake-runner/rb/patch/bdd/teamcity/cucumber/common.rb:18:in `<top (required)>'
/home/build/.rvm/gems/ruby-2.2.0/gems/cucumber-1.3.18/lib/cucumber/rb_support/rb_language.rb:95:in `load'
/home/build/.rvm/gems/ruby-2.2.0/gems/cucumber-1.3.18/lib/cucumber/rb_support/rb_language.rb:95:in `load_code_file'
/home/build/.rvm/gems/ruby-2.2.0/gems/cucumber-1.3.18/lib/cucumber/runtime/support_code.rb:180:in `load_file'
/home/build/.rvm/gems/ruby-2.2.0/gems/cucumber-1.3.18/lib/cucumber/runtime/support_code.rb:83:in `block in load_files!'
/home/build/.rvm/gems/ruby-2.2.0/gems/cucumber-1.3.18/lib/cucumber/runtime/support_code.rb:82:in `each'
/home/build/.rvm/gems/ruby-2.2.0/gems/cucumber-1.3.18/lib/cucumber/runtime/support_code.rb:82:in `load_files!'
/home/build/.rvm/gems/ruby-2.2.0/gems/cucumber-1.3.18/lib/cucumber/runtime.rb:184:in `load_step_definitions'
/home/build/.rvm/gems/ruby-2.2.0/gems/cucumber-1.3.18/lib/cucumber/runtime.rb:42:in `run!'
/home/build/.rvm/gems/ruby-2.2.0/gems/cucumber-1.3.18/lib/cucumber/cli/main.rb:47:in `execute!'
/home/build/.rvm/gems/ruby-2.2.0/gems/cucumber-1.3.18/bin/cucumber:13:in `<top (required)>'
/home/build/.rvm/gems/ruby-2.2.0/bin/cucumber:23:in `load'
/home/build/.rvm/gems/ruby-2.2.0/bin/cucumber:23:in `<main>'
/home/build/.rvm/gems/ruby-2.2.0/bin/ruby_executable_hooks:15:in `eval'
/home/build/.rvm/gems/ruby-2.2.0/bin/ruby_executable_hooks:15:in `<main>'


May be it will help you to investigate what the problem is.

Thanks!
0
Avatar
Permanently deleted user

I tuned the tests run with rake through xvfb with ranas plugin, but i don't see real-time tests progress of the build, and there are no teamcity test service messages in the build log.

Step build log:

Cucumber Options: --expand --format Teamcity::Cucumber::Formatter
Starting: xvfb-run /home/build/BuildAgent/temp/agentTmp/build8962666720574869736.sh

Is it working as expected?

Thanks!

0

Could you please try running cucumber without xvfb-run?
I've tried next script and it works fine with TC 9.0.2:
    export RUBYLIB="%system.agent.home.dir%/plugins/rake-runner/rb/patch/bdd:%system.agent.home.dir%/plugins/rake-runner/rb/patch/common"
    bundle exec cucucmber --format "Teamcity::Cucumber::Formatter"

When running on agent from console do you see same behaviour?

I'm not sure how xvbf works with env variables. Will investigate it later today.

About approach with rake-runner and runas: do you see any output? is it reported at once or real-time within build process?

0
Avatar
Permanently deleted user

Hello, Vladislav!

Finally it works with export ruby lib command. Thank you very much for support!

One more question is it right that cucumber step count like single test in report?

Big thanks!

0

Hi Andrey,

Good to hear that.
So have you setup build with command line runner or rake-runner+runas?

About cucumber steps we have related issue: TW-30206 Watch/vote.

Regards,
Vladislav.

0
Avatar
Permanently deleted user

Vladislav,

Setup with command line runner, but i think for now there is no problem to setup with rake.

Thank you very much!

0

Please sign in to leave a comment.