0
我已经使用jasmine和chai为我的nodejs应用程序创建了一些测试。我正在研究使用CI构建在TFS中发布测试结果。有人能给我指导如何去做。在TFS上使用CI发布茉莉花测试结果
我写
import chai from 'chai';
import sinon from 'sinon';
import financialMapper from "../map/mappers/party-financials.mapper";
import * as _ from 'lodash';
var assert = chai.assert;
var expect = chai.expect;
let financials = { key: 160233,
data:
[ { companyId: 160233,
dataItemName: 'Cash and Cash Equivalents, Beginning of Period',
dataItemId: 2055,
dataItemvalueUSD: 207217000,
fiscalYear: 2016,
periodTypeId: 4,
fiscalQuarter: 4 },
{ companyId: 160233,
dataItemName: 'Preferred Dividend and Other Adjustments',
dataItemId: 97,
dataItemvalueUSD: 405000,
fiscalYear: 2016,
periodTypeId: 4,
fiscalQuarter: 4 },
{ companyId: 160233,
dataItemName: 'Basic Earnings Per Share - Total',
dataItemId: 3523,
dataItemvalueUSD: 0.43728,
fiscalYear: 2016,
periodTypeId: 4,
fiscalQuarter: 4 },
{ companyId: 160233,
dataItemName: 'Net Property Plant And Equipment',
dataItemId: 1004,
periodTypeId: 4,
dataItemvalueUSD: 123269000,
fiscalYear: 2016,
fiscalQuarter: 4 },
{ companyId: 160233,
dataItemName: 'Accounts Receivable, Total',
dataItemId: 1021,
dataItemvalueUSD: 892289000,
fiscalYear: 2016,
periodTypeId: 4,
fiscalQuarter: 4 },
{ companyId: 160233,
dataItemName: 'Net Income - (IS)',
dataItemId: 15,
dataItemvalueUSD: 65517000,
fiscalYear: 2016,
periodTypeId: 4,
fiscalQuarter: 4 },
{ companyId: 160233,
dataItemName: 'Accounts Payable, Total',
dataItemId: 1018,
dataItemvalueUSD: 246670000,
fiscalYear: 2016,
periodTypeId: 4,
fiscalQuarter: 4 },
{ companyId: 160233,
dataItemName: 'Interest Expense',
dataItemId: 208,
dataItemvalueUSD: -17878000,
fiscalYear: 2016,
periodTypeId: 4,
fiscalQuarter: 4 }]}
describe('party financials mapper test suit:', function() {
it('should return an array of financials items', function() {
let doc = financialMapper.map(financials).value[0]
assert.isArray(doc);
});
it('should return financials with period id equal to 4', function() {
let doc = financialMapper.map(financials).value[0]
assert.equal(doc[0].historical[0].periodTypeId,4);
});
it('should return financials item with name equal to : <Interest Expense>', function() {
let docs= financialMapper.map(financials).value[0]
let doc = _.find(docs, (item)=>{
return item.name==='Interest Expense'
})
assert.isTrue(doc.name==='Interest Expense');
});
it('should return financials item with data item id equal to: <208>', function() {
let docs= financialMapper.map(financials).value[0]
let doc = _.find(docs, (item)=>{
return item.name==='Interest Expense'
})
assert.equal(doc.dataItemId,208);
});
it('should return financials item with current value equal to :<-17878000>', function() {
let docs= financialMapper.map(financials).value[0]
let doc = _.find(docs, (item)=>{
return item.name==='Interest Expense'
})
assert.equal(doc.current,-17878000);
});
});
此示例仅用于角度项目。我正在从事的项目是nodejs项目 – Tom
您现在如何运行测试?我只用它与角色单位测试运行与业力,但它应该与任何测试运行器,允许您添加一个记者到配置。否则,您可能会分叉回购并根据需要进行定制。 – tehbeardedone
我没有使用角度应用程序。我创建了一个节点js应用程序。我正在通过命令提示符 – Tom