Thursday 15 March 2012

testing - Run Jasmine tests on a view in a MVC project. -



testing - Run Jasmine tests on a view in a MVC project. -

i'm trying set testing chutzpah in visual studio 2013 , jasmine tests. can utilize fixtures load in html files, , far understand these set within default harness file's body.

instead, i'd create tests actual production code , run tests on masterpage utilize views check has loaded correctly, looks way should etc.

is there obvious way this?

sounds looking more functional style testing unit testing. if still want utilize phantomjs headless browser recommend using casperjs provides easy way automate webpage navigation , assertion.

for example, hear excerpt their documentation on testing:

casper.test.begin('google search retrieves 10 or more results', 5, function suite(test) { casper.start("http://www.google.fr/", function() { test.asserttitle("google", "google homepage title 1 expected"); test.assertexists('form[action="/search"]', "main form found"); this.fill('form[action="/search"]', { q: "casperjs" }, true); }); casper.then(function() { test.asserttitle("casperjs - recherche google", "google title ok"); test.asserturlmatch(/q=casperjs/, "search term has been submitted"); test.asserteval(function() { homecoming __utils__.findall("h3.r").length >= 10; }, "google search \"casperjs\" retrieves 10 or more results"); }); casper.run(function() { test.done(); }); });

testing model-view-controller jasmine jasmine-jquery

No comments:

Post a Comment