Skip to content

Commit

Permalink
feat: 添加用例统计 #48
Browse files Browse the repository at this point in the history
  • Loading branch information
BetaGo committed Oct 29, 2019
1 parent 5161c77 commit e884a4a
Showing 1 changed file with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,37 @@ class InterfaceColContent extends Component {
this.handleColdata(this.props.currCaseList);
};

getSummaryText = () => {
const { rows } = this.state;
let totalCount = rows.length || 0;
let passCount = 0; // 测试通过
let errorCount = 0; // 请求异常
let failCount = 0; // 测试失败
let loadingCount = 0; // 测试中
rows.forEach(rowData => {
let id = rowData._id;
let code = this.reports[id] ? this.reports[id].code : 0;
if (rowData.test_status === 'loading') {
loadingCount += 1;
return;
}
switch (code) {
case 0:
passCount += 1;
break;
case 400:
errorCount += 1;
break;
case 1:
failCount += 1;
break;
default:
passCount += 1;
break;
}});
return `用例共 (${totalCount}) 个,其中:["Pass: ${passCount} 个 ", "Loading: ${loadingCount} 个 ", "请求异常: ${errorCount} 个", "验证失败: ${failCount} 个"]`
};


render() {
const currProjectId = this.props.currProject._id;
Expand Down Expand Up @@ -1164,6 +1195,9 @@ class InterfaceColContent extends Component {
<div className="component-label-wrapper">
<Label onChange={val => this.handleChangeInterfaceCol(val, col_name)} desc={col_desc} />
</div>
<h3 className="interface-title">
{this.getSummaryText()}
</h3>

<Table.Provider
components={components}
Expand Down

0 comments on commit e884a4a

Please sign in to comment.