Testing 在MVC项目中的视图上运行Jasmine测试。

Testing 在MVC项目中的视图上运行Jasmine测试。,testing,model-view-controller,jasmine,jasmine-jquery,Testing,Model View Controller,Jasmine,Jasmine Jquery,我正试图在VisualStudio2013和Jasmine测试中使用Chutzpah设置测试。我可以使用fixture加载html文件,据我所知,这些文件将放在默认线束文件的主体中 相反,我想为实际的生产代码创建测试,并基本上在母版页上运行一些测试,我们使用母版页来检查所有视图是否正确加载,外观是否正确等等 有什么明显的方法可以做到这一点吗?听起来你在寻找比单元测试更多的功能风格测试。如果您仍然想使用PhantomJS headless浏览器,我建议您使用它,它提供了一种自动化网页导航和断言的简

我正试图在VisualStudio2013和Jasmine测试中使用Chutzpah设置测试。我可以使用fixture加载html文件,据我所知,这些文件将放在默认线束文件的主体中

相反,我想为实际的生产代码创建测试,并基本上在母版页上运行一些测试,我们使用母版页来检查所有视图是否正确加载,外观是否正确等等


有什么明显的方法可以做到这一点吗?

听起来你在寻找比单元测试更多的功能风格测试。如果您仍然想使用PhantomJS headless浏览器,我建议您使用它,它提供了一种自动化网页导航和断言的简单方法

例如,hear摘自以下测试:

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 is the one expected");
        test.assertExists('form[action="/search"]', "main form is found");
        this.fill('form[action="/search"]', {
            q: "casperjs"
        }, true);
    });

    casper.then(function() {
        test.assertTitle("casperjs - Recherche Google", "google title is ok");
        test.assertUrlMatch(/q=casperjs/, "search term has been submitted");
        test.assertEval(function() {
            return __utils__.findAll("h3.r").length >= 10;
        }, "google search for \"casperjs\" retrieves 10 or more results");
    });

    casper.run(function() {
        test.done();
    });
});

我自己也得出了同样的结论,并计划研究Selenium和NUnit,但CasperJS看起来非常适合我的需要:)谢谢你的提示!:)