Cucumber reports in PDF

983 views
Skip to first unread message

Behdad

unread,
Apr 9, 2012, 8:58:19 PM4/9/12
to Cukes
Hi everyone,

I am very new to Cucumber, Ruby and Selenium. I have recently figured
out how to set up the environment and write and run very simple
projects.
I am trying to print my reports in PDF. As instructed by cucumber I
installed the prawn gem by saying:

gem install prawn

and it successfully installed.

I used the following command line trying to print:

cucumber --format pdf --out MyReport.pdf

I also tried

bundle exec cucumber --format pdf --out MyReport.pdf

But I get the following error:

undefined method `text' for #<Prawn::Document:0x1459e18>
Error creating formatter: pdf (NoMethodError)
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.3/lib/cucumber/
formatter/pdf.rb:44:in `initialize'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.3/lib/cucumber/cli/
configuration.rb:172:in `new'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.3/lib/cucumber/cli/
configuration.rb:172:in `block in formatters'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.3/lib/cucumber/cli/
configuration.rb:167:in `map'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.3/lib/cucumber/cli/
configuration.rb:167:in `formatters'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.3/lib/cucumber/cli/
configuration.rb:72:in `build_tree_walker'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.3/lib/cucumber/
runtime.rb:43:in `run!'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.3/lib/cucumber/cli/
main.rb:43:in `execute!'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.3/lib/cucumber/cli/
main.rb:20:in `execute'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.3/bin/cucumber:14:in
`<top (required)>'
C:/Ruby193/bin/cucumber:19:in `load'

I have used the following sample code to generate a PDF using prawn
and it worked:

require 'prawn'

Prawn::Document.generate("test.pdf") do
font "#{Prawn::BASEDIR}/data/fonts/DejaVuSans.ttf"
text "this is a test " * 100
end

So I think prawn has installed correctly.

My Gem file looks like this:

source :rubygems

group :test do
gem 'cucumber', '1.1.3'
gem 'rspec-expectations', '2.7.0'
gem 'selenium-webdriver', '2.20.0'
gem 'prawn', '0.12.0'
end

and my env looks like:

RubyGems Environment:
- RUBYGEMS VERSION: 1.8.16
- RUBY VERSION: 1.9.3 (2012-02-16 patchlevel 125) [i386-mingw32]
- INSTALLATION DIRECTORY: C:/Ruby193/lib/ruby/gems/1.9.1
- RUBY EXECUTABLE: C:/Ruby193/bin/ruby.exe
- EXECUTABLE DIRECTORY: C:/Ruby193/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-mingw32
- GEM PATHS:
- C:/Ruby193/lib/ruby/gems/1.9.1
- C:/Documents and Settings/Administrator/.gem/ruby/1.9.1
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/

and prawn is installed in:

C:/Ruby193/lib/ruby/gems/1.9.1/gems/prawn-0.12.0

Anyone please can help me fix this?

Thanks.

Cheers,
Behdad.

aslak hellesoy

unread,
Apr 10, 2012, 5:17:37 AM4/10/12
to cu...@googlegroups.com
On Tue, Apr 10, 2012 at 1:58 AM, Behdad <beh...@gmail.com> wrote:
> Hi everyone,
>
> I am very new to Cucumber, Ruby and Selenium. I have recently figured
> out how to set up the environment and write and run very simple
> projects.
> I am trying to print my reports in PDF. As instructed by cucumber I
> installed the prawn gem by saying:
>
> gem install prawn
>

You need prawn and prawn-layout 0.8.4.

Uninstall your current prawn(s) and install those versions:

gem uninstall prawn
gem install prawn --version 0.8.4
gem install prawn-layout --version 0.8.4

The pdf formatter has been removed from master, and will not be in the
next release - it has been moved to a separate gem.
See https://github.com/cucumber/cucumber/issues/241

Aslak

> --
> You received this message because you are subscribed to the Google Groups "Cukes" group.
> To post to this group, send email to cu...@googlegroups.com.
> To unsubscribe from this group, send email to cukes+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/cukes?hl=en.
>

Behdad

unread,
Apr 12, 2012, 5:44:22 AM4/12/12
to cu...@googlegroups.com
Thank you for the information Aslak. I will try this soon.
Cheers,
Behdad.

> To unsubscribe from this group, send email to cukes+unsubscribe@googlegroups.com.

Behdad

unread,
Apr 13, 2012, 2:15:20 AM4/13/12
to cu...@googlegroups.com
Aslak,

Sorry as I am a new in this area. When I try to install the specified version it comes up with error saying that it can't find it in any repository.

C:\>gem install prawn --version 0.8.4
ERROR:  Could not find a valid gem 'prawn' (= 0.8.4) in any repository
ERROR:  Possible alternatives: prawn

Is there something that I am doing wrong.

Thank you.

Aslak Hellesøy

unread,
Apr 13, 2012, 2:33:45 AM4/13/12
to cu...@googlegroups.com




On Apr 13, 2012, at 7:15, Behdad <beh...@gmail.com> wrote:

Aslak,

Sorry as I am a new in this area. When I try to install the specified version it comes up with error saying that it can't find it in any repository.

C:\>gem install prawn --version 0.8.4
ERROR:  Could not find a valid gem 'prawn' (= 0.8.4) in any repository
ERROR:  Possible alternatives: prawn

Is there something that I am doing wrong.


That's right. Try again.

Aslak

> To unsubscribe from this group, send email to cukes+un...@googlegroups.com.


> For more options, visit this group at http://groups.google.com/group/cukes?hl=en.
>

--
You received this message because you are subscribed to the Google Groups "Cukes" group.
To view this discussion on the web visit https://groups.google.com/d/msg/cukes/-/5hm6pzEX0DMJ.

To post to this group, send email to cu...@googlegroups.com.
To unsubscribe from this group, send email to cukes+un...@googlegroups.com.

Matt Wynne

unread,
Apr 13, 2012, 3:41:46 AM4/13/12
to cu...@googlegroups.com
On 13 Apr 2012, at 07:15, Behdad wrote:

Aslak,

Sorry as I am a new in this area. When I try to install the specified version it comes up with error saying that it can't find it in any repository.

C:\>gem install prawn --version 0.8.4
ERROR:  Could not find a valid gem 'prawn' (= 0.8.4) in any repository
ERROR:  Possible alternatives: prawn

Is there something that I am doing wrong.

You've got a problem installing the prawn gem. The best place to ask for help with that would be here: http://help.rubygems.org/

To view this discussion on the web visit https://groups.google.com/d/msg/cukes/-/5hm6pzEX0DMJ.
To post to this group, send email to cu...@googlegroups.com.
To unsubscribe from this group, send email to cukes+un...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/cukes?hl=en.

cheers,
Matt


sai krishna

unread,
Jun 12, 2014, 3:18:23 AM6/12/14
to cu...@googlegroups.com, beh...@gmail.com
i have installed the following gem and i get the below error on running my cucumber profile 

cannot load such file -- pdf
Error creating formatter: pdf (LoadError)
/Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.15/lib/cucumber/constantize.rb:17:in `rescue in constantize'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.15/lib/cucumber/constantize.rb:6:in `constantize'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.15/lib/cucumber/cli/configuration.rb:83:in `formatter_class'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.15/lib/cucumber/cli/configuration.rb:182:in `block in formatters'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.15/lib/cucumber/cli/configuration.rb:178:in `map'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.15/lib/cucumber/cli/configuration.rb:178:in `formatters'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.15/lib/cucumber/cli/configuration.rb:76:in `build_tree_walker'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.15/lib/cucumber/runtime.rb:46:in `run!'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.15/lib/cucumber/cli/main.rb:47:in `execute!'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.15/bin/cucumber:13:in `<top (required)>'
/usr/bin/cucumber:23:in `load'
/usr/bin/cucumber:23:in `<main>'
Reply all
Reply to author
Forward
0 new messages