HELP Watir-Webdriver/Cucumber with Rufus/Lua

62 views
Skip to first unread message

Usman Hussain

unread,
Dec 3, 2010, 10:36:30 AM12/3/10
to Rufus Ruby
Hi Guys,
Sorry to disturbe you,

But I came across Rufus/Lua and have been having some trouble with it.
Due to there not being alot of information available about Lua ont he
net I thought I would drop you an email.

I am currently using watir-webdriver with Cucumber in Ruby.
So I have created a framework based around these. But One of the tests
that is becoming more needed at my work place is the need to Automate
Flash/Flex.

I have managed this by using Lua.

BUT I am now having trouble integrating it into my framework.
Is there anyway I can get this to work along with Watir? So I can just
paste in my Lua script into my Ruby script and it will run the test?

Any help would be much appreciated. If you need any more information
regarding the tools I am using then please do not hesitate to ask me.

Sorry I might also add that I am using a MAC and have follwed all the
instructions on:
http://lua-users.org/lists/lua-l/2006-09/msg00894.html

In my env.rb file I am requiring the following:
require 'rubygems'

require 'watir-webdriver'

require 'rspec'

require 'rufus/lua'


and am still not getting anywhere.

I keep on getting the following error:
no library specified (LoadError)
/Library/Ruby/Gems/1.8/gems/ffi-0.6.3/lib/ffi/library.rb:79:in
`ffi_libraries'
/Library/Ruby/Gems/1.8/gems/ffi-0.6.3/lib/ffi/library.rb:106:in
`attach_function'
/Library/Ruby/Gems/1.8/gems/rufus-lua-1.1.0/lib/rufus/lua/lib.rb:62
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
/Library/Ruby/Gems/1.8/gems/rufus-lua-1.1.0/lib/rufus/lua.rb:25
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in
`gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `require'
/Users/usman.hussain/Documents/Aptana RadRails Workspace/random/
features/support/env.rb:4
/Library/Ruby/Gems/1.8/gems/cucumber-0.9.4/bin/../lib/cucumber/
rb_support/rb_language.rb:143:in `load'
/Library/Ruby/Gems/1.8/gems/cucumber-0.9.4/bin/../lib/cucumber/
rb_support/rb_language.rb:143:in `load_code_file'
/Library/Ruby/Gems/1.8/gems/cucumber-0.9.4/bin/../lib/cucumber/runtime/
support_code.rb:176:in `load_file'
/Library/Ruby/Gems/1.8/gems/cucumber-0.9.4/bin/../lib/cucumber/runtime/
support_code.rb:78:in `load_files!'
/Library/Ruby/Gems/1.8/gems/cucumber-0.9.4/bin/../lib/cucumber/runtime/
support_code.rb:77:in `each'
/Library/Ruby/Gems/1.8/gems/cucumber-0.9.4/bin/../lib/cucumber/runtime/
support_code.rb:77:in `load_files!'
/Library/Ruby/Gems/1.8/gems/cucumber-0.9.4/bin/../lib/cucumber/
runtime.rb:137:in `load_step_definitions'
/Library/Ruby/Gems/1.8/gems/cucumber-0.9.4/bin/../lib/cucumber/
runtime.rb:39:in `run!'
/Library/Ruby/Gems/1.8/gems/cucumber-0.9.4/bin/../lib/cucumber/cli/
main.rb:48:in `execute!'
/Library/Ruby/Gems/1.8/gems/cucumber-0.9.4/bin/../lib/cucumber/cli/
main.rb:21:in `execute'
/Library/Ruby/Gems/1.8/gems/cucumber-0.9.4/bin/cucumber:8
/usr/bin/cucumber:19:in `load'
/usr/bin/cucumber:19

Kind regards,
Usman Hussain

John Mettraux

unread,
Dec 3, 2010, 10:56:26 AM12/3/10
to rufus...@googlegroups.com

On Fri, Dec 03, 2010 at 07:36:30AM -0800, Usman Hussain wrote:
>
> Is there anyway I can get this to work along with Watir?
> So I can just paste in my Lua script into my Ruby script and it will run
> the test?

Hello Usman,

I don't know, I've never used Watir.

> Any help would be much appreciated. If you need any more information
> regarding the tools I am using then please do not hesitate to ask me.
>
> Sorry I might also add that I am using a MAC and have follwed all the
> instructions on:
> http://lua-users.org/lists/lua-l/2006-09/msg00894.html
>
> In my env.rb file I am requiring the following:
>
> require 'rubygems'
> require 'watir-webdriver'
> require 'rspec'
> require 'rufus/lua'
>
> and am still not getting anywhere.
>
> I keep on getting the following error:
> no library specified (LoadError)
> /Library/Ruby/Gems/1.8/gems/ffi-0.6.3/lib/ffi/library.rb:79:in
> `ffi_libraries'
> /Library/Ruby/Gems/1.8/gems/ffi-0.6.3/lib/ffi/library.rb:106:in
> `attach_function'
> /Library/Ruby/Gems/1.8/gems/rufus-lua-1.1.0/lib/rufus/lua/lib.rb:62

What do

find /usr -name liblua*

and

find /opt -name liblua*

yield on your system ?

Where is your liblua.dylib ?

Did you follow the instructions at

https://github.com/jmettraux/rufus-lua/blob/master/README.rdoc

?

---8<---
make
make macosx # or make linux ...
make -C src liblua.dylib
sudo cp src/liblua.dylib /usr/local/lib/

sudo make macosx install
--->8---


Best regards,

--
John Mettraux - http://jmettraux.wordpress.com

Usman Hussain

unread,
Dec 6, 2010, 8:35:04 AM12/6/10
to Rufus Ruby
Hi John,

Yeah i followed the instructions on the link provided but when i run
my ruby script it just throws an error.

Basically i need to run a Lua script from a Ruby script.. am just
trying to find a way of doing this.

Kind regards,
Usman Hussain

John Mettraux

unread,
Dec 6, 2010, 8:39:55 AM12/6/10
to rufus...@googlegroups.com

On Mon, Dec 06, 2010 at 05:35:04AM -0800, Usman Hussain wrote:
>
> Yeah i followed the instructions on the link provided but when i run
> my ruby script it just throws an error.

Hello Usman,

does it throw an error or does it throw the same error your reported in your initial email ?

> Basically i need to run a Lua script from a Ruby script.. am just
> trying to find a way of doing this.

I am repeating myself, but :

what do

� find /usr -name liblua*

and

� find /opt -name liblua*

yield on your system ?

Where is your liblua.dylib ?

Did you follow the instructions at

https://github.com/jmettraux/rufus-lua/blob/master/README.rdoc

?

---8<---
make
make macosx # or make linux ...
make -C src liblua.dylib
sudo cp src/liblua.dylib /usr/local/lib/

sudo make macosx install
--->8---


Thanks in advance,


P.S.

reading these documents will enhance your issue reporting skills :

- http://www.catb.org/~esr/faqs/smart-questions.html
- http://www.chiark.greenend.org.uk/~sgtatham/bugs.html

Usman Hussain

unread,
Dec 17, 2010, 10:07:39 AM12/17/10
to Rufus Ruby
Hi John,

Sorry about the late reply. I have been away and have only got back to
my computer to return a reply.

Ok from the terminal on my MAC when i do:
find /usr -name liblua*
i get: /usr/local/lib/liblua.a

when i do:
find /opt -name liblua*
i get: find: /opt: No such file or directory

My liblua.dylib is in a folder on my desktop.
the path is:
/Users/usman.hussain/Desktop/ruby-lua/lua-5.1.4/src/liblua.dylib

I am also getting this error:
/Library/Ruby/Gems/1.8/gems/ffi-1.0.0/lib/ffi/library.rb:93:in
`ffi_libraries': no library specified (LoadError)
from /Library/Ruby/Gems/1.8/gems/ffi-1.0.0/lib/ffi/library.rb:129:in
`attach_function'
from /Library/Ruby/Gems/1.8/gems/rufus-lua-1.1.0/lib/rufus/lua/lib.rb:
62
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
`require'
from /Library/Ruby/Gems/1.8/gems/rufus-lua-1.1.0/lib/rufus/lua.rb:25
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in
`gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in
`require'
from rubylua.rb:4

I have ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
installed
and the following versions of ffi installed: ffi (1.0.0, 0.6.3)

kind regards,
Usman Hussain




On Dec 3, 3:56 pm, John Mettraux <jmettr...@openwfe.org> wrote:

John Mettraux

unread,
Dec 17, 2010, 10:23:16 AM12/17/10
to rufus...@googlegroups.com

On Fri, Dec 17, 2010 at 07:07:39AM -0800, Usman Hussain wrote:
>
> Ok from the terminal on my MAC when i do:
> find /usr -name liblua*
> i get: /usr/local/lib/liblua.a
>
> when i do:
> find /opt -name liblua*
> i get: find: /opt: No such file or directory
>
> My liblua.dylib is in a folder on my desktop.
> the path is:
> /Users/usman.hussain/Desktop/ruby-lua/lua-5.1.4/src/liblua.dylib
>
> I am also getting this error:
> /Library/Ruby/Gems/1.8/gems/ffi-1.0.0/lib/ffi/library.rb:93:in
> `ffi_libraries': no library specified (LoadError)
> from /Library/Ruby/Gems/1.8/gems/ffi-1.0.0/lib/ffi/library.rb:129:in
>
> I have ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
> installed
> and the following versions of ffi installed: ffi (1.0.0, 0.6.3)

Hello Usman,

try to do

export LUA_LIB=/Users/usman.hussain/Desktop/ruby-lua/lua-5.1.4/src/liblua.dylib

before running your ruby program.

I hope it will help.

Usman Hussain

unread,
Dec 17, 2010, 10:39:23 AM12/17/10
to Rufus Ruby
Ah Fantastic John,

Absolute legend. that did work.
thank you so much for you help with that.

Usman Hussain
Reply all
Reply to author
Forward
0 new messages