Unable to run cucumber test on intellij idea 12 - ruby

I have followed all necessary steps an installed ruby and bundle.
which ruby
/Users/v-bpurkayastha/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
which gem
/Users/v-bpurkayastha/.rvm/rubies/ruby-1.9.3-p194/bin/gem
but on intellij idea while running it say
Cucumber support disabled because 'cucumber-rails' gem or Cucumber Rails plugin
are missing. Install gem and add it to the Gemfile
On run configuration it says
No cucumber gem found in sdk
even after selecting sdk.
Please help me out.
many thanks,

I have had a similar issue with my IntelliJ Idea 14 where it was incorrectly assigning the path for Gems bin directory under project settings' SDK for Ruby.
I changed it to /.rvm/gems/ruby-2.1.4/bin and when running the cucumber tests it picks it up and run the acceptance tests.

I had the same problem. When I viewed the module settings it did show the cucumber gem in the list. I clicked on the cucumber gem and clicked 'update gems'. It did find a newer version of the cucumber gem (1.3.15 instead of 1.3.14) and updated it. I was able to run my cucumber tests after that with no error.

For my version (IntelliJ 2018.3 Ultimate), since my project is consisted of java modules as well as cucumber test module (in the "test/func" folder). I had to
Set up ruby and its gem
Import the test folder as a module
Project Setting -> Modules, add a module by import existing source
Add the Ruby SDK to that module

Related

Sikuli IDE can't import cucumber gem in JRuby?

I'm using SikuliX IDE 1.1.2 (with JRuby support enabled), and I'm trying to get cucumber working from within the Sikuli IDE.
I have found this article which just covers what I need:
http://www.jmest.org/wp-content/uploads/JMESTN42350420.pdf
I have also found the related github and I am now trying to run a sample script in Ruby that I found here: https://github.com/rssdev10/sikulix-ide-templates/blob/master/examples/libreoffice-writer-test/test-cucumber.sikuli
But when I try to run this script from the Sikuli IDE, I get:
LoadError: no such file to load -- cucumber/rspec/disable_option_parser require at org/jruby/RubyKernel.java:939 require at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:54 start_cucumber at C:/Users/at080olimath/Downloads/sikulix-ide-templates-master/examples/libreoffice-writer-test/test-cucumber.sikuli:31 cucumber_test at C:/Users/at080olimath/Downloads/sikulix-ide-templates-master/examples/libreoffice-writer-test/test-cucumber.sikuli:56 SikulixCucumber at C:/Users/at080olimath/Downloads/sikulix-ide-templates-master/examples/libreoffice-writer-test/test-cucumber.sikuli:62 <top> at C:/Users/at080olimath/Downloads/sikulix-ide-templates-master/examples/libreoffice-writer-test/test-cucumber.sikuli:67
[error] script [ test-cucumber ] stopped with error in line 31
[error] LoadError ( (LoadError) no such file to load -- cucumber/rspec/disable_option_parser )
On a Google Drive link, I was able to find a .jar file which contains all the gems needed (cucumber etc.), but the archive is old (2014) and contains a beta verison of the Sikuli IDE:
https://drive.google.com/drive/folders/0Bwx0cbtdU5K6STg2T0l5UWlIRXc
As per my understanding, I would need a way to build the sikulix.jar with the Cucumber gem included... But I cannot manage to figure out where to get started.
On this documentation page, I can also find that this is possible to include cucumber in sikuli.jar:
https://github.com/RaiMan/SikuliX1
If you want to experiment with the special JRuby support (rSpec,
cucumber, ...) you have to look into the modules JRubyAddOns and
JRubyGem. Both have to be built manually if needed (not contained in
the local developement build).
While I was able to find the JRubyGem, I am unable to find the JRubyAddOns anywhere... And I don't know what to do next :(
How should I proceed to get cucumber working from within the SikuliX IDE 1.1.2?
Thank you for your help
I think stock Cucumber Gem has C-dependencies that won't execute VM-side for Jruby. This here: https://rubygems.org/gems/cucumber-jvm/versions/2.0.1-java might be more what you're looking for. Good luck!

Using Gemfiles with Budler with two projects

TL;TR
We have two projects (minitest project, and a page objects project). The Minitest project uses the page object project. When Jenkins runs the tests, we use a remote git path to the page objects project. When we run it locally we change the gem file in the minitest project to use a local path\or local git repo. This results in us needing to continuously change the gem file. We don't wan't to have to do this. How can we set this up so that we don't need to keep changing the gem file?
The long version
I have two Ruby projects, which are tightly coupled. Both projects are used to support testing with Capybara. One project contains Minitest tests. The other project contains page objects. The minitest project uses the page object project. The page object project is published as a gem so that other teams can use it. Quite often we need to edit both projects at once.
I am using Bundler to manage the gems. These projects used to be in two different git repos.
The tests run in Jenkins, and when we work on them we run them locally. When the tests run in Jenkins the minitest project can reference the page objects project either as a published gem or as a remote git repo.
The problem we had with this is that we kept needing to change the gem file of the minitest project. We would change it from pointing to a remote git repo, to a checked out (local) path. Or we would point to a local git repo. In this case we would still need to update the minitest project's gem file with the local branch name. We needed to edit the gem file with either approach, then we had to remember to change this back before checking in and merging.
We then moved both projects into a single repo. Now the gem file in the minitest project only uses the relative path e.g. path => .... This means that we don't need to constantly update the gem file in the minitest project. However, now when we run bundle install or bundle update, only the gem file from the minitest project is used (at least this is what I assume is happening).
How do I use a different gem path\git repo on my dev machine to what is used in Jenkins, without continuously changing the gem file?
I would like to know what approach should I be using in this case? Can avoid making changes to the minitest project's gem file?
Consider using bundler's groups (in Gemfile):
group :project1 do
gem 'rspec'
end
group :project2 do
gem 'minitest'
end
Then specify which group to use in application.rb, for example
Bundler.require(:project1) # or :project2 depending on the project
More info here: http://bundler.io/groups.html

Can a ruby gem/module be added just like a java jar file?

I use Eclispse Kepler with DLTK plugin for ruby. I am unable to "require" nokogiri module because it cannot be found by eclipse. I tried some gem install command from some website and that did not help. Now, I don't want to use commandline until I first master Ruby programming.
I learned that I can add java jars to my project by creating a lib folder, copying jars to that folder and then adding them all to the build path. So easy, right ?
Can I do the same thing for ruby gems and modules ? Ideally, I'd like to use only the IDE for this instead of using commandline and complext install scripts.
Please help.
If this gem already installed with all dependencies, then you can add it with simple require command:
require "/path_to_gems/gem_name/lib/gem_name"
In my case the command is:
require '/Users/yukke/.rvm/gems/ruby-2.1.1/gems/nokogiri-1.6.1/lib/nokogiri'
Otherwise you can try to require rubygems first:
require "rubygems"
require "gem-name"
I would suggest maybe using a different IDE with better Ruby support, such as Aptana, which is Eclipse-based but has a lot of additional addons to support Ruby development. You can install Ruby gems in it on the start page, or through the integrated terminal.
If you run the command gem which bundler you will see the folder gems are installed on your system.
You can copy executables there but it's highly recommended you use gem install on the command line.
I have find the answer to this question. I not sure if this is the best way to do it, but it works for me. Pro developers, can you please review this answer ? So, for now let me give quick guide for this.
1 - Install Eclipse DLTK plugin for Ruby as suggested here - Preferred Ruby plugin for Eclipse?
See the answer with photo, by James.
2 - Next, lets pick a random gem such as nokogiri and download it from rubygems.org. The file name of the Gem tells you which OS its meant for. I use windows 7 64bits. So, I take version with x64-mingw32. Here is a sample list of downloads:
1.6.4.1 November 7, 2014 java (2.37 MB)
1.6.4.1 November 7, 2014 x64-mingw32 (2.86 MB)
1.6.4.1 November 7, 2014 (8.81 MB)
1.6.4.1 November 7, 2014 x86-mingw32 (3.91 MB)
1.6.4 November 5, 2014 java (2.37 MB)
Show all versions (271 total)
3 - AFAIK, eclipse cannot use the gem file as is. You need to unpack it first. Lets say you kept the gem file in c:\RubyGems\extras, and you want to unpack it there itself.
open windows cmd > cd into the above directory > gem unpack nokogiri-1.6.4.1-x64-mingw32.gem > press enter !!!
Now, your gem will be unpacked into a folder nokogiri-1.6.4.1-x64-mingw32.
4 - Locate the nokogiri.rb file inside the unpacked folder. Its in the lib folder.
Copy the full path of this folder - c:\RubyGems\extras\nokogiri-1.6.4.1-x64-mingw32\lib. We need this for eclipse.
5 - Eclipse > create new ruby project > right click project > build path > configure build path > libraries tab > add external source folder > enter the path from step 4 > Ok > ok. You can now use the gem in your project.
6 - Testing if the steps work. Use the code in your project !
require 'nokogiri'
puts "Chenqui ! It is work!!!"
If the message prints without error, then you are a success ! To see the error you get when the required modules can't be found, add something like this require 'restclient'.

Building CompassApp (jruby app) executable from source on Windows

I would like to build the executable of CompassApp, a GUI application that lets webdesigners compile stylesheets by using SASS and Compass without using the command line.
The source can be found on GitHub here: https://github.com/handlino/CompassApp.
CompassApp is a an application developed in Jruby.
From the GitHub webpage of the project:
If you want to build your own copy, you will need JRuby and rawr
I am using Windows 7 as operating system for my webdesign projects. I never built a jruby app from source. It seems on linux it's easier to install the required things, anyway i'm using Windows now.
First i cloned the GitHub repository.
Then i installed jruby.
Now i should install rawr (https://github.com/rawr/rawr)
It seems that rawr also requires javac and rake
I saw that rawr and rake are 2 ruby gems.
So how do i install those 2 ruby gems for jruby on Windows?
And how do i build CompassApp from source after i have everything i need?
I would need a step by step guide from the install of the requirements
to the build of the application.
(i never used jruby in the past).
If someone of you develops apps in jruby i think that can help me easily.
I thank you in advance.
#Fabio Hi, we made Compass.app and Fire.app :-)
It is easy to build Compass.app on OS X or Linux. We have a (almost) step by step guide about building Fire.app on the GitHub wiki and it can be applied to Compass.app too: https://github.com/handlino/FireApp/wiki
We have never tried to build it on Windows, and do not think it can be done easily.
I'm trying to do a similar thing, but in my case only package the gems in a self-contained executable jar. the docs are not very descriptive and some are outdated.
I tried rawr but managed to get further with warbler
here's what I did: I created a folder named jrcompass and installed compass into it:
c:\test\jrcompass>%JRUBY%\jruby -S gem install compass -i .
I installed warbler and then ran the warble command in that folder:
C:\test\jrcompass>c:\apps\jruby\bin\jruby -S warble
that created a ~20MB jar file named jrcompass.jar which is farther than I got with rawr.
now I'm trying to execute the jar with:
C:\test\jrcompass>java -jar jrcompass.jar
and I get the following error below. I hope that this will help you make progress. please let me know if you figure it out.
Gem::LoadError: Could not find compass (>= 0) amongst [rake-0.9.2.2]
to_specs at jar:file:/C:/Users/Admin/AppData/Local/Temp/jruby1564362137331239458extract/jruby-stdlib-1.7.1.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/dependency.rb:247
to_spec at jar:file:/C:/Users/Admin/AppData/Local/Temp/jruby1564362137331239458extract/jruby-stdlib-1.7.1.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/dependency.rb:256
gem at jar:file:/C:/Users/Admin/AppData/Local/Temp/jruby1564362137331239458extract/jruby-stdlib-1.7.1.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems.rb:1231
(root) at file:/C:/Apps/test/jrcompass/jrcompass.jar!/jrcompass/bin/compass:22
load at org/jruby/RubyKernel.java:1046
(root) at file:/C:/Apps/test/jrcompass/jrcompass.jar!/META-INF/main.rb:1
require at org/jruby/RubyKernel.java:1027
(root) at file:/C:/Apps/test/jrcompass/jrcompass.jar!/META-INF/main.rb:1
(root) at jar:file:/C:/Users/Admin/AppData/Local/Temp/jruby1564362137331239458extract/jruby-stdlib-1.7.1.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_require.rb:1

Cucumber with Ruby: Can it be used from a gem?

I'd like to develop some reusable step definitions and scenario outlines for Cucumber in Ruby.
I've scoured the Cucumber wiki but there seems to be no info on use of Cucumber with Ruby gems.
Is there support for execution of a feature from an installed Gem?
Or would a user have to manually change to the gem installation directory and explicitly referenced the feature(s) to run from there?
If I understood your question correctly, all you need is to create some lib for reusable definitions and steps, and then require this lib(or gem) in features/support/env.rb
Here is a gem does exactly the same as you need, you can use it as a reference: https://github.com/jayzes/cucumber-api-steps
Look at the features this gem provide: https://github.com/jayzes/cucumber-api-steps/blob/master/features/request.feature The gem created some reusable parts.
Turns out cucumber --help shows the way:
cucumber -r gem-name feature-name.feature
UPDATE: This doesn't work. Any other suggestions?
There is a cucumber gem which installs the binary cucumber.
Running this command, will assume default settings. This means it will look under ./features relative to the current path for files with the .feature extension. It will expect ./features/step_definitions to hold files with *_step.rb, where it will search for steps.
Edit: never mind, I misread your question and thought you wanted to know about the cucumber gem and its default paths.

Resources