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.
Related
Before upgrading to rails 5.1 i test my rails app via integration tests. And 70% of my rails app is automated via integration tests. Means all of application simple and complex behaviors are automated via integration tests. Off-course rails did not provided any java-script based testing.
With Arrival of Rails 5.1 they include system tests and said that every app interact with java-script and now you can test your app end to end scenarios like a real user interacting with browser. So my manager ask me to move all integration tests to system tests. Ok good! we can test our application the way our users experience it and help us test JavaScript as well.
Definitely system test can cover almost all integration tests as well. So whats the importance of integration testing now ?
Why should someone write integration test in Rails 5.1 when he can
write same test case in System test?
Thanks in advance.
I wonder the same, but from this I get the impression that system tests will replace integration testing - however, the only drawback seems to be speed and resource usage.
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)
I have a good understanding of the differences between unit and intergration tests in RoR in theory. I'm using rspec and capybara to do a lot of testing on my site. What I don't understand is how do you run different tests? If I do
bundle exec rspec
it will run all of my specs in all of my spec folders (model, controller, views, integration, etc). If I want to run an integration test, is it as simple as ?
bundle exec rspec spec/integration
I know there are some differences between these types of test behind the scenes. Specifically this problem (which I also have) has me thinking about unit vs. integration: How to test for a redirect with Rspec and Capybara
What does Rails do differently when running integration tests? The solution posted in the above problem is
Checking for redirect is not supported in rspec-rails request specs,
but is supported in Rails integration tests.
So how do I make one of my tests an integration test? Is it just a matter of putting it in the right spec folder?
As I understand it rspec is designed specifically for unit testing purposes, thus you'll need to use something else for integration testing. The message seems it imply that Rails can do integration tests as well. I don't have any experience or knowledge of testing in rails alone, but I do know of the cucumber gem that is built very well for integration tests.
It has it's own domain specific language and other quirks you'll need to get used to but it should have the capability you're looking for.
I can't seem to find anything except Rails' own documentation on its integration testing platform. Why doesn't anyone use it? How did it die out? What are alternatives?
The Rails integration test suite was never great, and projects like Cucumber have since taken over.
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.