Unit testing 使用yeoman的ReSharper Jasmine AngularJS单元测试
我正在尝试让yeoman生成的单元测试使用Resharper 8.0.2在Visual Studio中运行 使用yeoman,如果您只生成一个控制器,您将得到如下结果:Unit testing 使用yeoman的ReSharper Jasmine AngularJS单元测试,unit-testing,angularjs,jasmine,visual-studio-2013,resharper-8.0,Unit Testing,Angularjs,Jasmine,Visual Studio 2013,Resharper 8.0,我正在尝试让yeoman生成的单元测试使用Resharper 8.0.2在Visual Studio中运行 使用yeoman,如果您只生成一个控制器,您将得到如下结果: 'use strict'; describe('Controller: MainCtrl', function () { // load the controller's module beforeEach(module('angularYeomanTestApp')); var MainCtrl, s
'use strict';
describe('Controller: MainCtrl', function () {
// load the controller's module
beforeEach(module('angularYeomanTestApp'));
var MainCtrl,
scope;
// Initialize the controller and a mock scope
beforeEach(function() {
inject(function($controller, $rootScope) {
scope = $rootScope.$new();
MainCtrl = $controller('MainCtrl', {
$scope: scope
});
})
});
it('should attach a list of awesomeThings to the scope', function () {
expect(scope.awesomeThings.length).toBe(3);
});
});
我已经转移了的知识,因为yeoman在inject语句之前没有生成匿名函数
问题是每次测试我都会出错,比如:
Inconclusive: Test wasn't run
Resharper被配置为使用chrome浏览器运行测试,当它打开时,jasmine似乎被正确地包含在测试页面中,但是测试页面是空的
使用karma运行测试,例如grunt测试确实有效
谢谢你的帮助
注:我正在使用:Visual-Studio-2013、Resharper 8.0.2、angularjs 1.2.6Karma和Reshaper彼此无关。您不必运行或安装karma来运行Resharper测试。对于resharper测试,正如我在上面的评论中指出的,您必须在每个测试文件中包含所有需要作为“引用”的文件 这是你的完整测试吗?您是否包含了对所有需要的js文件的引用?使用resharper,为了运行测试,您必须在包含测试之前引用所有js文件。如果您拖动它们,vs将为您创建它们。类似于///是的,这是完整的测试。Karma配置为将大约15个文件或其他内容加载到浏览器中。我应该手动添加它们吗?是否有可能在所有测试中都包含一组标准的引用?@Sentenza:是的,我无法让它工作。我的参考文件包括angular、jasmin和要测试的服务以及app.js-file。但它仍然不起作用。。。