我正在尝试让Jasmine使用Visual Studio测试资源管理器。因此,我的测试文件如下所示:
/// <reference path="../wwwroot/lib/angular/angular.min.js" />
/// <reference path="../wwwroot/lib/angular-mocks/angular-mocks.js" />
/// <reference path="../wwwroot/lib/jasmine/lib/jasmine-core/jasmine.js" />
/// <reference path="../wwwroot/lib/angular-arrays/dist/angular.arrays.js" />
/// <reference path="../wwwroot/lib/angular-simple-cache/dist/simplecache.js" />
/// <reference path="../wwwroot/lib/angular-toastr/dist/angular-toastr.tpls.min.js" />
/// <reference path="../wwwroot/lib/ng-file-upload/ng-file-upload.min.js" />
/// <reference path="../app/common/common.js" />
/// <reference path="../app/common/services.js" />
var _sharedProductHandler,
_pricingProducts,
_availabilityProducts;
beforeEach(module('piiick.common'));
beforeEach(inject(['SharedProductHandler', function (sharedProductHandler) {
_sharedProductHandler = sharedProductHandler;
_pricingProducts = [{
productId: 0
}];
_availabilityProducts = [{
productId: 0
}];
}]));
describe('Service: SharedProductService', function () {
it('We have a list of pricing products', function () {
expect(_pricingProducts.length).toBeGreaterThan(0);
});
it('We have a list of availability products', function () {
expect(_availabilityProducts.length).toBeGreaterThan(0);
});
});如果我在浏览器中打开,测试运行正常。但我希望它们出现在测试资源管理器中。我为测试资源管理器安装了Chutzpah适配器,但是我的测试没有出现在那里。I read that you can use a chutzpah.json file to add settings,所以我这样做了,但是我不能让我的测试出现在测试资源管理器中。我认为值得一提的是,我正在使用Visual Studio 2015。
谁知道如何让我的测试显示在测试资源管理器中?
发布于 2016-05-24 06:27:33
是的,我解决了这个问题..chutzpah.json文件需要在根目录中(它可以在任何位置,但路径设置必须相对于json文件所在的位置。我的是这样的:
{
"Framework": "jasmine",
"References": [
{ "Path": "wwwroot/lib/angular/angular.min.js" },
{ "Path": "wwwroot/lib/angular-mocks/angular-mocks.js" },
{ "Path": "wwwroot/lib/jasmine/lib/jasmine-core/jasmine.js" },
{ "Path": "wwwroot/lib/angular-arrays/dist/angular.arrays.js" },
{ "Path": "wwwroot/lib/angular-simple-cache/dist/simplecache.js" },
{ "Path": "wwwroot/lib/angular-toastr/dist/angular-toastr.tpls.min.js" },
{ "Path": "wwwroot/lib/ng-file-upload/ng-file-upload.min.js" },
{ "Path": "app/common/common.js" },
{ "Path": "app/common/services.js" }
],
"Tests": [
{ "Path": "tests" }
]
}等级库文件不再需要任何引用,因此可能如下所示:
var _sharedProductHandler,
_pricingProducts,
_availabilityProducts;
beforeEach(module('piiick.common'));
beforeEach(inject(['SharedProductHandler', function (sharedProductHandler) {
_sharedProductHandler = sharedProductHandler;
_pricingProducts = [{
productId: 0
}];
_availabilityProducts = [{
productId: 0
}];
}]));
describe('Service: SharedProductService', function () {
it('We have a list of pricing products', function () {
expect(_pricingProducts.length).toBeGreaterThan(0);
});
it('We have a list of availability products', function () {
expect(_availabilityProducts.length).toBeGreaterThan(0);
});
});仅供我参考,bower.json只需要这两个:
{
"name": "ASP.NET",
"private": true,
"dependencies": {
"angular-mocks": "^1.5.5",
"jasmine": "^2.4.1"
},
"ignore": [
"tests"
]
}https://stackoverflow.com/questions/37397171
复制相似问题