Skip to content

Commit 1603236

Browse files
committed
回归测试:解决无标准的情况下没有提示;解决各种undefined和null导致的bug
1 parent 6edcec4 commit 1603236

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@
9595
<ul v-show="isRemoteShow" class="historys" style="width: 100%;height: 100%;overflow: hidden;overflow-y: scroll;padding-bottom: 50px">
9696
<li v-for="(item, index) in remotes" >
9797
<a href="javascript:void(0)" @click="restore(item)" > {{(item.version > 0 ? 'V' + item.version : 'V*') + ' ' + item.name + ' ' + item.url}}</a>
98-
<div :style="{ background: item.compareColor }" v-show="item.compare != null && item.compare > 0" style="position: absolute;right: 30px;display: inline-block;">
99-
<button @click="handleTest(false, index, item)" style="position: relative;color: red">错误,已解决</button>
98+
<div :style="{ background: item.compareColor }" v-show="item.compare != null && item.compare != 0" style="position: absolute;right: 30px;display: inline-block;">
99+
<button v-show="item.compare != null && item.compare > 0" @click="handleTest(false, index, item)" style="position: relative;color: red">错误,已解决</button>
100100
<svg class="icon" style="position: relative;margin-left: 10px" @click="downloadTest(index, item)">
101101
<use xlink:href="svg/icon.svg#export-txt"></use>
102102
</svg>

js/main.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -823,18 +823,18 @@
823823
}
824824

825825
if (callback != null) {
826-
callback(url, res, null)
826+
callback(url, res || {}, null)
827827
return
828828
}
829-
App.onResponse(url, res, null)
829+
App.onResponse(url, res || {}, null)
830830
})
831831
.catch(function (err) {
832832
log('send >> error:\n' + err)
833833
if (callback != null) {
834-
callback(url, null, err)
834+
callback(url, {}, err)
835835
return
836836
}
837-
App.onResponse(url, null, err)
837+
App.onResponse(url, {}, err)
838838
})
839839
},
840840

@@ -1273,7 +1273,7 @@
12731273
saveTextAs(
12741274
'# APIJSON自动化回归测试-前\n主页: https://github.com/TommyLemon/APIJSON'
12751275
+ '\n\n接口: ' + (item.version > 0 ? 'V' + item.version : 'V*') + ' ' + item.name
1276-
+ '\nResponse: \n' + JSON.stringify(JSON.parse(item.response), null, ' ')
1276+
+ '\nResponse: \n' + JSON.stringify(JSON.parse(item.response || '{}'), null, ' ')
12771277
, 'APIJSON自动化回归测试-前.txt'
12781278
)
12791279

@@ -1288,7 +1288,7 @@
12881288
saveTextAs(
12891289
'# APIJSON自动化回归测试-后\n主页: https://github.com/TommyLemon/APIJSON'
12901290
+ '\n\n接口: ' + (item.version > 0 ? 'V' + item.version : 'V*') + ' ' + item.name
1291-
+ '\nResponse: \n' + JSON.stringify(JSON.parse(tests[item.id]), null, ' ')
1291+
+ '\nResponse: \n' + JSON.stringify(JSON.parse(tests[item.id] || '{}'), null, ' ')
12921292
, 'APIJSON自动化回归测试-后.txt'
12931293
)
12941294
}, 5000)

0 commit comments

Comments
 (0)