add apitest

This commit is contained in:
aozhiwei 2021-11-16 17:39:13 +08:00
parent 0ccd8c3d63
commit 51af678d37
2 changed files with 15 additions and 2 deletions

13
bin/apitest Executable file
View File

@ -0,0 +1,13 @@
#!/usr/bin/python
import os
import sys
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../scripts/postman')
import apitest
workDir = os.getcwd()
test = apitest.ApiTest(workDir)
test.convert()
if len(sys.argv) > 1 and sys.argv[1] == 'run':
os.system('newman run ' + test.getOutFileName())

View File

@ -5,10 +5,10 @@ import sys
import json
from urllib import parse as urlparse
class Mocking(object):
class ApiTest(object):
def __init__(self, workDir):
self._workDir = workDir + '/mocking/'
self._workDir = workDir + '/tests/'
def convert(self):
self._env = json.loads(open(self._workDir + 'env.json', 'r').read())