Quantcast
Channel: Chutzpah - A JavaScript Test Runner
Viewing all articles
Browse latest Browse all 1864

New Post: Functional Testing in Chutzpah?

$
0
0
Can anyone suggest a way of doing functional testing (e.g. browser automation) through Chutzpah/Jasmine tests, or a product that will integrate with Chutzpah? For example, if I were using PhantomJS (which won't work obviously) a simple test might look something like this...
describe("Load Speed", function() {
  var page = require('webpage').create(),
    system = require('system'),
    t, address;

  t = Date.now();
  address = system.args[1];

  page.open(address, function(status) {
    it("should load the address", function() {
      expect(status).toEqual('success');
    });

    if (status == 'success') {
      t = Date.now() - t;
      it("should load in under 5 seconds", function() {
        expect(t).toBeLessThan(5000);
      });
    }
    phantom.exit();
  });
});
Obviously I could just use PhantomJS without Chutzpah, but we're already using Jasmine (via Chutzpah) for our unit tests, and also we enjoy the Visual Studio integration that Chutzpah provides.

Thanks,
Caleb.

Viewing all articles
Browse latest Browse all 1864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>