How to integrate Vaadin with Cucumber - vaadin

Is there a way to integrate Vaadin7 with Cucumber? Can Vaadin Testbench help me with this task? Is Vaadin Testbench necessary for this task?

Cucumber just executes the gherkin scenarios. The integration between vaadin and cucumber is in fact an integration between vaadin and selenium on the one side and selenium and cucumber on the other side.
You will have to write glue-code and steps that work with selenium webdrivers which encapsulates the vaadin pages.
If you are not experienced with these domains it is probably the best to buy a license for the testbench. You don't need it if you are able and willing to provide the needed drivers and settings yourself.
Take a look at this project to get some inspirations: https://github.com/holisticon/demo-cucumber-vaadin (demo uses guice and vaadin6 so it might not fit but will show some basic set up)

Related

Converting Selenium IDE tests to run in rspec without browser

We have a rails app and some users have used Selenium IDE firefox extension to record/create some tests. We'd like to be able to integrate these tests into our codebase of automated tests.
I understand that Selenium IDE has the ability to export test cases, but what is the easiest way to convert these tests into something that rspec can run without a browser (or headless)?
I've used both. Here is what you can do
export the file using the rspec webdriver format
adjust any use of variables or local file storage that is possible in selenium to make sense using rspec. This will depend totally on your usage.
Here's what one goes through:
Select the test you want to export (you can also export the entire suite)
Export as rspec webdriver
Open the resulting file
Adjust as needed, e.g. move common items to spec_helper.rb and make sure it is included.
Put the file in an rspec folder, e.g. spec/views and make sure that spec_helper includes them.
I understand that Selenium IDE has the ability to export test cases, but what is the easiest way to convert these tests into something that rspec can run without a browser (or headless)?
Selenium IDE is only plugin for Firefox.
I believe, you can to do the same steps on another language/way.
But for this you need to have another code.
Code for Selenium Web Driver is possible to use with headless browser as phantomJS. And its easy.
But Selenium IDE code is only for Firefox IDE plugin.
And by the way, its hard to maintain tests written using IDE. I believe, better to rewrite all tests using Selenium WebDriver in your case. Its will be much easier and faster. (you can use Page Object model for this, as example)

Should I use Cucumber for an AngularJS single page application?

I'm fairly new to both Cucumber and Angular. I have a rails application that is a single page application. Should I bother with Cucumber or should I just use AngularJS's e2e testing?
Any insight, comparison and past experience is appreciated!
We use a combination of Cucumber and Jasmine for our Angular application.
Months ago when I initially tried to get Angular's e2e testing framework running , the documentation was pretty limited so we opted for Cucumber - Selenium for the UI tests.
I believe with Angular's e2e framework you can mock calls to backend but if you want to do actual integration testing using Cucumber + Selenium is a decent option.
You should check out Cucumber.js.
If you're looking for a more comprehensive example using Protractor checkout this angular-cucumber-example.

Using Rails with Webrat + Selenium or only Selenium?

I'm reading The Rspec Book, and in that book they are using Webrat with Selenium.
Is it possible to use Selenium directly for integration tests in Rails instead of using it through Webrat?
What are the pros and cons with each way?
It is most definitely possible to use Selenium by itself. I recommend installing the Selenium IDE plugin for Firefox. This gives you an easy scripting layer to automate clicks and that sort of thing. By integrating Selenium with Rails, you can execute integration tests from the command line, which is nice for a number of reasons: other developers on your team can run them more easily, you can run the same tests against multiple browsers more easily, and you can run the tests from a continuous integration server (that can launch a web browser).
We use Cucumber with Capybara for our integration tests. Webrat does not support JavaScript, so if you click a link that has a click event handler for example, the handler won't fire. Capybara knows Javascript so will fire the event handler. Selenium would let you do this as well, but we already use Cucumber and I prefer Cucumber+Capybara tests to Selenium because it is more integrated and the tests are easier to maintain.

Integrate test process with Rspec and Cucumber in a plugin using Desert

I'm developing some rails plugins with desert, and I would like to use tests with RSpec and Cucumber in the development. RSpec is integrated by default in Desert plugins, but it gives me some bugs.
Finally I have created a minimal application which use my plugin, and I try to test it like a normal application without plugin. But I dislike that solution, the plugin lost its modularity, and RSpec still returns me some bugs (he can't find the models/views/controllers located in the plugin...).
So am I the only one who try to test a Desert plugin (or even in a classic plugin) ? May anyone know those matters and get a solution ?
I was working with 'Desert' plug-ins in a legacy Rails 2.2.2 app and the following helped me http://pivotallabs.com/users/joe/blog/articles/985-testing-desert-plugins-in-isolation
You should not use desert plugin, it's an 'old thing'.

Automated code sanity check tools for Ruby

What tools do you use for automated code sanity checks and adhering to the coding conventions in your Ruby apps? How do you incorporate them into your process? (I mean tools like roodi, reek, heckle, rcov, dcov, etc.)
I'd suggest taking a look at RuboCop. It is a Ruby code style checker based on the Ruby Style Guide. It's maintained pretty actively and it's based on standard Ruby tooling (like the ripper library). It works well with Ruby 1.9 and 2.0 and has great Emacs integration.
The metric_fu gem might be perfect for what you need. From it's README: "Metric-fu is a set of rake tasks that make it easy to generate metrics reports. It uses Saikuro, Flog, Rcov, and Rails'
built-in stats task to create a series of reports. It's designed to integrate easily with CruiseControl.rb by placing files in the Custom Build Artifacts folder." Since they converted it to a gem, it works with non-Rails applications as well. I'll bet you could add hooks for other tools as well.
There was some good discussion on this topic on the On-Ruby blog recently. For my personal development process I build quality tools into my tests, but only after all other tests have run. So I have a top-level rake task that looks something like this:
desc 'Runs all unit tests, acceptance tests and quality checks'
task 'test' => ['test:spec', 'test:features', 'test:quality']
I allow myself to commit if the last suite "fails", but I do try to get them to zero at least once each day.

Resources