最近有个想法,想造一个dsl 用来做简单的移动应用的http 冒烟测试。不知大家是否有这种需求,或者提议
[initialize]
@
limit = 12
@
offset = 24
[index]
> GET /
accept_encoding => gzip, deflate, sdch
code: 200
content <- LoginModal
[item]
> GET /api/channels/1/items limit=@limit offset=@offset
code: 200
json: ['code']=200
json: ['data']['items'][1]['type'] = "post"
上面的dsl将会生成下面的code
class Testtest(WebTestCase):
def setUp(self):
self.client = client
self.initialize()
def initialize(self):
self.limit=12
self.offset=24
def test_index(self):
headers = {}
headers['Accept-Encoding'] = 'gzip, deflate, sdch'
data = {}
self.client.do_request('GET', '/', data, headers)
self.assertCode('200')
self.assertContent('<-', 'LoginModal()')
def test_item(self):
headers = {}
data = {}
data['limit'] = self.limit
data['offset'] = self.offset
self.client.do_request('GET', '/api/channels/1/items', data, headers)
self.assertCode('200')
json = self.client.json
json = json['code']
self.assertJson(json, ':', 200)
json = self.client.json
json = json['data']['items'][1]['type']
self.assertJson(json, ':', "po1st")
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
https://www.v2ex.com/t/167011
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.