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