0

I am new to node.js I want to try to write node.js client for my web site testing (stuff like login, filling forms, etc...) Which module should i use for that? Since I want to test user login following other user functionality it should be able to keep session like browser Also any site where it has example of using that module? Thanks

1
  • you want to write a testing client from scratch or are you looking for the state of the art modules for behavior testing? It it's the latter, look at casper + phantom and mocha. Commented Jun 13, 2014 at 1:54

1 Answer 1

1

As Amenadiel has said in the comments, you might want to use something like Phantom.js for testing websites.

But if you're new to node.js maybe try with something light, like Zombie.js.

An example from their home page:

var Browser = require("zombie");
var assert = require("assert");
// Load the page from localhost
browser = new Browser()
browser.visit("http://localhost:3000/", function () {
  // Fill email, password and submit form
  browser.
    fill("email", "[email protected]").
    fill("password", "eat-the-living").
    pressButton("Sign Me Up!", function() {

      // Form submitted, new page loaded.
      assert.ok(browser.success);
      assert.equal(browser.text("title"), "Welcome To Brains Depot");

    })

});

Later on, when you get the hang of it, maybe switch to Phantom (which has webkit beneath, so it's not emulating the Dom).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.