年前小分享,借鉴了twill的dsl灵感,库现在主要用来做mobile端或者api化的平台冒烟测试。
实现的化主要是python的metaclass,与正则及模板化
1. 支持python testcase doc test
2. dsl文件测试
3. 自动跟踪保持cookies
戳:
https://github.com/thomashuang/natumedemo:
[initialize]
@
key = "苏打绿"
[index]
> GET /
content <- 虾米音乐网(xiami.com)
[song api]
> GET /song/playlist/id/1772167572/type/0/cat/json
content_type: application/json
charset: utf-8
json: ['data']['trackList'][0]['title'] = u'再遇见'
json: ['data']['trackList'][0]['song_id'] = '1772167572'
json: ['data']['type_id'] = 1
[search]
> GET /search/collect key='苏打绿'
code: 200
content <- 苏打绿歌曲: 最好听的苏打绿音乐试听
content =~ /Xiami.com/i
[search page 2]
> GET /search/collect/page/2 key=@key order='weight'
code: 200
content <- 苏打绿歌曲: 最好听的苏打绿音乐试听
content =~ /XiaMi.com/i