Take the 2-minute tour ×

I want to do a smoke test in order to test the connection between my web app and the server itself. Does Someone know how to do it? In addition I want to do an acceptance tests to test my whole application. Which tool do you recommend?

My technology stack is: backbone and require.js and jquery mobile and jasmine for BDD test.


share|improve this question
Are you doing this test manually (by hand, e.g. open the page in a browser) or automated (writing code to test this functionality)? –  Uooo Feb 7 '13 at 13:54
I want to do a Job in Jenkins that run a test which performs the acceptance and smoke test. Currently I am investigating capybara, Have you used this tool? –  McSas Feb 7 '13 at 14:05
add comment

3 Answers

When doing BDD you should always mock the collaborators. The tests should run quickly and not depend on any external resources such as servers, APIs, databases etc.

The way you would want to make in f.e. Jasmine is to declare a spy that pretends to be the server. You then move on to defining what would be the response of the spy in a particular scenario or example.

This is the best aproach if you want your application to be environment undependent. Which is very needed when running Jenkins jobs - building a whole infrastructure around the job would be hard to reproduce.

Make spy/mock objects that represent the server and in your specs define how the external sources behave - this way you can focus on what behavior your application delivers under specified circumstances.

share|improve this answer
Many thanks for you answer karolsojko. Nevertheless I don want to make unit tests, I want to do an acceptance tests that works with jenkins. I thought that the best option is capybara, Did you use this tool? Which tool do you recommend for acceptance test? –  McSas Feb 7 '13 at 18:12
For acceptance tests (or actualy doing StoryBDD) a good choice would be Cucumber.js (github.com/cucumber/cucumber-js) or Kyuri (github.com/nodejitsu/kyuri) pick your poison ;) –  karolsojko Feb 7 '13 at 20:16
Thank you karolsojko, one hour ago I could set up a ruby + capybara + cucumber app in order to run in jenkins and be part of my deployment pipeline :) –  McSas Feb 7 '13 at 20:28
add comment
up vote 0 down vote accepted

I found a blog post where the author explain how to use capybara, cucumber and selenium outside a rails application and therefore can be use to test a javascript app. Here are the link: http://testerstories.com/?p=48#comment-8180

share|improve this answer
add comment

This isn't a complete answer, but one tool we've been using for our very similar stack is mockJSON. It's a jQuery plugin that does a nice job both:

  1. intercepting calls to a URL and instead sending back mock data and
  2. making it easy to generate random mock data based on templates.

The best part is that it's entirely client side, so you don't need to set up anything external to get decent tests. It won't test the actual network connection to your server, but it can do a very good job validating that type of data your server would be kicking back. FWIW, we use Mocha as our test framework and haven't had any trouble getting this to integrate with our BDD work.

The original mockJSON repo is still pretty good, though it hasn't been updated in a little while. My colleagues and I have been trying to keep it going with patches and features in my own fork.

share|improve this answer
add comment

Your Answer


