Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I want to test my AngularJS application using Selenium and PhantomJS, but I am not finding an easy to start resource or video tutorial. Can you please suggest some good resource as a starting point.

share|improve this question
    
Do you want to do unit or e2e tests? As i am into all of this at the moment, I can send you good links. –  glepretre Feb 7 '14 at 14:41
    
@glepretre I have to test if the website I have build is functioning properly and the flow are correct or not so i think it will be E2E testing.Please share those links. –  Utpal Feb 10 '14 at 6:46

2 Answers 2

up vote 1 down vote accepted

As @Nima-Vaziri said, you should have a look at Karma to run unit tests on your app. This article will help you on this way.

Then to run e2e tests, the new runner developped by the Angular team is Protractor and you can start with this demo : Protractor demo

To understand, these docs were very useful to me:

If you're going to work with AngularJS: you definitely should know about eggehead.io videos! This one is about Protractor. But, there's a lot of video tutorials very interesting to teach you how to build an Angular app!

share|improve this answer

Have you looked at this tutorial?

The tutorial itself seems decent. You might have to change some stuff depending on what you choose as your test-runner (this tutorial chose Mocha).

I'd also look at Karma and Protractor which are built by the AngularJS team. Protractor is targeted more towards end-to-end testing in AngularJS apps.

If you're set on Selenium, you could also look at Nightwatchjs which is also end-to-end and runs against a Selenium server but requires Node.js. Nightwatchjs could be compared to Protractor but seems like it has easier-to-understand syntax.

share|improve this answer
    
which one according to you is more suitable for unit testing and E2E testing. Is it PhantomJS or Karma. Please suggest. –  Utpal Feb 10 '14 at 6:49
    
i have tried the selenium and phantomjs tutorial suggested by you with the simple google.com example but got stuck while running the test script using Mocha.What will be the syntax to run that.Really I got stuck very badly. –  Utpal Feb 10 '14 at 12:07
    
I'd suggest Karma simply because it's primarily made for AngularJS so it fits really nice. The AngularJS team has been improving their documentation so at least you may find it easier to set up your work than it would be before. There are some tutorials - karma-runner & this one touches on PhantomJS as well - on how to use Karma and Jasmine together for testing purposes. I don't know how much you know about TDD but Jasmine promotes a BDD style testing which is a subset of TDD. –  Nima Vaziri Feb 10 '14 at 13:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.