5

We are at the beginning of a new web project that will use JavaScript and in particular angularJs. NodeJs will also be used.I am looking for the best practices in terms of automating "E2E testing" for a web project built with JavaScript.

The biggest concern is the selection of the testing framework. We are not interested in Unit tests, since this will be a task for the development organisation, however if we can merge those unit tests in the new automation testing framework, that would be a plus. So the question is "what is the optimal way to test JavaScript these days?"

The incorporation of a "reporting tool" for managerial reason would also be a plus. Are there any reporting tool for JavaScript automation tests?

A third concern is a potential need to test mixed scenarios with mobile applications. For example UserA is logged in the web browser and chats with UserB that is connected with his iPhone. How can you glue a scenario like this?

Free and open source tools are mandatory.

cateof
  • 6,608
  • 25
  • 79
  • 153

5 Answers5

7

To update @Vidya's answer, the Angular team is actually developing a new end-to-end testing framework called Protractor. It should be released along-side the new version of Angular 1.2. Its got some really great features and is built on WebDriver for Selenium.

It has built-in integration for running your end-to-end test suites in Sauce Labs which has some great reporting tools and will do things like record a screencast of the test running so that you can go back later and watch the test fail to see what went wrong. They also provide a bunch of different mobile device emulators that you can test your suites against so that you can test desktop and mobile browsers at the same time.

As for actual "test coverage" reporting, it can be hard to do when you're doing E2E tests because you're not truly writing tests to cover specific code statements or controllers or functions, but instead you're testing the website's functionality. So I haven't actually found any plugins/frameworks that help with doing E2E test coverage. If anyone has any ideas, I would love to hear them.

But using the combination of Protractor and Sauce Labs, we've been really happy with how our tests execute and the analytics we're able to get back with very little effort on our part. Hope that helps.

tennisgent
  • 14,165
  • 9
  • 50
  • 48
5

I really think you want to look at Karma for your situation. It was actually created by the Angular.js team. It is a very popular test runner with mobile support as well.

Meanwhile, you might also like to integrate Istanbul into Karma for code coverage.

Vidya
  • 29,932
  • 7
  • 42
  • 70
  • 1
    Angular is moving E2E tests to their new Protractor project. – Preston Marshall Oct 24 '13 at 15:33
  • 1
    Protractor is coupled to Angular apps only. Karma is not and remains quite viable. So there are pros and cons to each. Leave it to the OP to make his/her judgment instead of enforcing your own with a simplistic downvote. The information I gave isn't wrong, let alone "egregiously sloppy" or "dangerously incorrect." So you should expand your technical knowledge and learn the community rules before downvoting: http://stackoverflow.com/help/privileges/vote-down. – Vidya Oct 24 '13 at 16:02
  • The poster specifically mentions AngularJS. AngularJS's docs specifically say this (http://docs.angularjs.org/guide/dev_guide.e2e-testing at the top in bold). @tennisgent's answer is more correct, so I upvoted it and downvoted yours. The way I see it, your answer is incorrect. Update it and I'll remove the downvote. Finally, I'm not sure how my technical knowledge has any bearing on my downvote in this situation. – Preston Marshall Nov 19 '13 at 05:11
5

+1 to the above answers. I just wanted to add to tennisgent's answer. With a little bit of tinkering, I managed to get istanbul coverage working with protractor. I posted details under a more-specific question. Code coverage for Protractor tests in AngularJS

Community
  • 1
  • 1
ryanb
  • 934
  • 7
  • 4
1

I can propose to take a look at TestCafe. It's a pure node.js end-to-end solution for testing web apps. TestCafe is suitable for all your goals. Now it's the easiest to install framework. You'll have opportunity to start browsers, running tests and take a detailed report about test run. TestCafe even provide way to start tests on Saucelabs. All of this is include in TestCafe out-of-th-box.

TestCafe team plans to implement the test scenario with testing in several browser windows at the same time (like your chating of two user example) issue. As far as I know none of the existing framework currently does not support this scenario.

I'm a developer from TestCafe team, so feel free to ask me if you have any questions

Community
  • 1
  • 1
Helen Dikareva
  • 1,026
  • 6
  • 7
0

Turboframework uses javascript, jasmine, selenium and runs with node. You can literally create a test project and run web automated tests in 10 minutes. Just follow the start guide:

https://turboframework.org/en/blog/2021-03-03/automate-your-web-application-tests-in-less-than-ten-minutes

Jaume Mussons Abad
  • 706
  • 1
  • 6
  • 20