Integrating karma-runner and cucumberjs - angularjs

Has anyone used karma-runner/testacular to execute cucumberjs tests? I suspect that I may have to write an adapter like the Jasmine adapter. Any knowledge on integrating a test library with karam-runner would be much appreciated.

I'm currently using an adapter I wrote: https://npmjs.org/package/karma-cucumberjs
It's been working fine for me, I'm now using it on a second project. But I am sure there are changes that I could do to it once people start using it and finding things they wish it did. Let me know if there are any problems, you can email me at s9tpepper#apache.org or just use the GitHub issues on the repository. I don't check StackOverflow all that much unless I'm looking for an answer to a specific question.

This seems to be something people want. Jon Perl started karma-cucumber recently. It does not include a Karma reporter for Cucumber.js yet but seems to be the plan.
I'll also be looking into this in the near future.

Related

Automated Accessibilty Testing Tools For Angular SPAs

I am wondering if anyone has experience with an automated accessibility testing tool for Angular Single Page Applications (SPA).
I have tried pa11y and it does not seem to be working consistently. Just wondering if there are any other tools out there which are comparable to pa11y in ease of use, but which work with Angular.
#Estus raised a good point in the comment — "does not seem to be working consistently" is not a lot to go on. Regardless, a couple options:
Take a look at protractor-accessibility-plugin for NPM which can lean on the Chrome Accessibility Developer Tools or Tenon.
Related, there is a tutorial on using Tenon as a Grunt task.
Level Access offers an implementation example of Continuum called 'Continuum for Protractor' that might be a good place to get started. It's available for free at webaccessibility.com. You can use it as a template or as a reference to integrate automated accessibility testing into your existing Protractor tests. Here's some more information if you're interested. I also help maintain Continuum Explorer, which is a free extension for Google Chrome that is framework-agnostic and more interactive if you think that might be a better match for your use case.

Karma-Jasmine with AngularJS realtime project

I have gone through several tutorials but none could really help me out.
I have also read through the documentation, which is easy for beginner test cases like to test for an array/string, etc. But i need some help in using it in a full-time project.
How to write these unit tests for not-so-simple cases like, matching what is displayed on the website is what should be expected?
Thanks!

Can I reuse/call existing API in Selenium-Java Framework into the Protractor Framework?

Please bear with me if this is a silly question. But thought of getting an idea.
We have a very sophisticated Selenium Webdriver-Java framework. But now some parts of our application is being implemented in AngularJS. We would like to use protractor for test automation. But we have some API in the existing framework which we would like to reuse. Is there a possibility to do so or do we need to re-write all the existing API in protractor?
Thanks
Not probably the answer you are looking for. But, this can give you some hope.
Unfortunately there is no protractor java port at this moment. I use Selenium C# and my project started using some Angular recently. And, fortunately, there is a Protractor-net project done by some great people to accomplish same thing you are struggling with. I must say, if your project is big enough to leverage some time to write a java port for protractor you can follow this project easily. It's not that extensive. I am personally using it and started writing about this on my blog
Some one is trying to develop jProtractor - An angular/protractor implementation for Java Selenium API. https://github.com/caarlos0/jProtractor
This is still under development(not in a position to use yet), but this could be the right tool for people who are in similar situation as me.

Adding functional tests to a Backbone.js application

I'm sorry if this question isn't appropriate: I'm new to test-driven development, especially on JavaScript.
I have a working Backbone.js application, and I'd like to add some JavaScript tests to it. But I don't really know where to start.
Specifically, I'd like to write tests that are passed a URL, and check that the rendered page contains particular DOM elements. (So functional tests, rather than unit tests, I guess.)
What is a good way to do this? Could anyone recommend good practical resources for getting tests like this up and running?
Apologies for the newbie question.
I have faced the same problem lately and Ryan Roemer book Backbone.js Testing (http://backbone-testing.com/) is a great place to start.
His process is not purely TDD, but he gives some nice tips.
When taking it to practice, I will recommend a Yeoman generator like:
https://github.com/mrichard/generator-marionette (Marionette)
https://github.com/revathskumar/generator-backbone-mocha (Backbone and Mocha)
https://github.com/richistron/generator-cornelio (Karma and Backbone)
They will save you some time on the setup. Also, if you are using Rails, Konacha https://github.com/jfirebaugh/konacha has been pretty handy for me.
Good testing!
Selenium is on de-factor way to run functional tests in the browser. Selenium has a firefox plugin that will record actions and replay them. That would be the easiest way to start. You can look at Selenium's API docs to write code to interact with the browser.
Sause Labs (http://saucelabs.com/docs/quickstart) has selenium in the cloud which is useful so you don't need to have a browser window open on you desktop and run the tests. PhantomJS can also run a "headless" browser (it does't open a window on you computer, just runs in the background).
Once you have selenium working you might want to look into acceptance testing. The tests are written in plain english use Gherkin (or similar) syntax and it runs functions to run the test and output reports if there were errors or not.
I wrote an article how to use Selenium for Acceptance Testing http://alex-craft.com/blog/2014/acceptance-testing-for-web-app
Tools: WebDriver (Selenium or Phantom.js), wd.js, node.js, mocha.js.
There's an example with explanation how to use meaningful names instead of CSS selectors, eventual conditions, etc.

Is protractor Angular's new scenario runner?

I heard recently that, Angular is switching to Protractor as the new end to end testing tool, is my understanding correct? I cloned and looked at the sample. I am able to run jasmine-node to see all the tests run fine. I am able to follow the example code, but just curious, Is there any write up available on this? I did not find any good documentation on it.
Thanks
In the AngularJS 1.2 and Beyond meetup last night they talked about Protractor and said that they are migrating all of their end to end tests to Protractor. It sounded like this is in the early stages but is the direction they are going. The slides are at: https://docs.google.com/presentation/d/1WHCcp3G3HxoE7b_ut_ERKJF4zQK_P4qFlESjE2E9AUQ/edit and I assume the video will be available in a couple of days. Here's the link to the meetup:
http://www.meetup.com/AngularJS-MTV/events/120927882/
btw, there was a ton of really interesting info in the meetup -- well worth the watch.
Yes it is since AngularJS 1.2. As you may see here, protractor is now part of the Angular's GitHub repository:
https://github.com/angular/protractor
You can start reading here:
https://github.com/angular/protractor/blob/master/docs/getting-started.md

Resources