如何在pyresttest中创建一个循环?

时间:2017-05-05 18:08:08

标签: pyresttest

我正在尝试在PyRestTest中创建一个循环,这是我的代码:

# Login
- test:
  - group: 'Login'
  - name: 'Test login post'
  - url: {template: 'api/login/'}
  - method: 'POST'
  - body: {template:'{"username":"$username",
                      "email":"$username",
                      "password":"$password"}'}
  - headers: {Content-Type: application/json}
  - extract_binds:
    - 'token': {'jsonpath_mini': "key"}

# Logout
- test:
  - group: 'Logout'
  - name: 'Test logout post'
  - url: {template: 'api/logout/'}
  - method: 'POST'
  - headers: {Content-Type: application/json}

如何反复执行此代码?我期待的是:

loop(10):
    # Login
    ...
    # Logout
    ...

为了执行10次这些测试。有可能吗?

0 个答案:

没有答案