Skip to content

Commit 5d8ac93

Browse files
committed
完成下载自动化回归测试的两个对比文件
1 parent c7af671 commit 5d8ac93

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

js/main.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,10 +1224,40 @@
12241224
}
12251225
},
12261226

1227+
/**
1228+
* @param index
1229+
* @param item
1230+
*/
12271231
downloadTest: function (index, item) {
1232+
saveTextAs(
1233+
'# APIJSON自动化回归测试-前\n主页: https://github.com/TommyLemon/APIJSON'
1234+
+ '\n\n接口: ' + (item.version > 0 ? 'V' + item.version : 'V*') + ' ' + item.name
1235+
+ '\nResponse: \n' + JSON.stringify(JSON.parse(item.response), null, ' ')
1236+
, 'APIJSON自动化回归测试-前.txt'
1237+
)
1238+
1239+
/**
1240+
* 浏览器不允许连续下载,saveTextAs也没有回调。
1241+
* 在第一个文本里加上第二个文本的信息?
1242+
* beyond compare会把第一个文件的后面一段与第二个文件匹配,
1243+
* 导致必须先删除第一个文件内的后面与第二个文件重复的一段,再重新对比。
1244+
*/
1245+
setTimeout(function () {
1246+
var tests = App.tests || {}
1247+
saveTextAs(
1248+
'# APIJSON自动化回归测试-后\n主页: https://github.com/TommyLemon/APIJSON'
1249+
+ '\n\n接口: ' + (item.version > 0 ? 'V' + item.version : 'V*') + ' ' + item.name
1250+
+ '\nResponse: \n' + JSON.stringify(JSON.parse(tests[item.id]), null, ' ')
1251+
, 'APIJSON自动化回归测试-后.txt'
1252+
)
1253+
}, 5000)
12281254

12291255
},
12301256

1257+
/**
1258+
* @param index
1259+
* @param item
1260+
*/
12311261
handleTest: function (right, index, item) {
12321262
if (right) {
12331263
var tests = App.tests || {}

0 commit comments

Comments
 (0)