Skip to content

Commit

Permalink
add day28 for httprunner test structure layer
Browse files Browse the repository at this point in the history
  • Loading branch information
smalltide committed Oct 14, 2019
1 parent 1b84ab9 commit 8415a8a
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 0 deletions.
1 change: 1 addition & 0 deletions day28/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
base_url=https://www.google.com
5 changes: 5 additions & 0 deletions day28/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
reports/*
__pycache__/*
*.pyc
.python-version
logs/*
11 changes: 11 additions & 0 deletions day28/api/google_search.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: google search
base_url: ${ENV(base_url)}
variables:
keyword: httprunner in api
request:
url: /search
method: GET
params:
q: $keyword
validate:
- eq: ["status_code", 200]
5 changes: 5 additions & 0 deletions day28/debugtalk.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

import time

def sleep(n_secs):
time.sleep(n_secs)
13 changes: 13 additions & 0 deletions day28/testcases/validate_title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
config:
name: testcase validate search result
base_url: ${ENV(base_url)}
variables:
keyword: httprunner in testcase

teststeps:
- name: validate title
api: api/google_search.yml
extract:
- title: "<title>(.*)</title>"
validate:
- startswith: ["$title", "$keyword"]
11 changes: 11 additions & 0 deletions day28/testsuites/google_search.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
config:
name: "testsuite google search"
base_url: ${ENV(base_url)}
variables:
keyword: httprunner in testsuite

testcases:
- name: call validate_title
testcase: testcases/validate_title.yml
- name: call validate_title2
testcase: testcases/validate_title.yml

0 comments on commit 8415a8a

Please sign in to comment.