change: make locusts as hrun sub-command, usage: hrun locusts -h

This commit is contained in:
debugtalk
2020-04-12 23:29:00 +08:00
parent 7a0b1b69e4
commit db722c92b9
10 changed files with 211 additions and 181 deletions

View File

@@ -1,20 +0,0 @@
config:
name: create users with uid
variables:
device_sn: ${gen_random_string(15)}
base_url: "http://127.0.0.1:5000"
testcases:
-
name: create user 1000 and check result.
testcase: testcases/create_user.yml
weight: 2
variables:
uid: 1000
-
name: create user 1001 and check result.
testcase: testcases/create_user.yml
weight: 3
variables:
uid: 1001

View File

@@ -1,19 +0,0 @@
import os
import unittest
from httprunner.ext.locusts.utils import prepare_locust_tests
class TestLocust(unittest.TestCase):
def test_prepare_locust_tests(self):
path = os.path.join(
os.getcwd(), 'tests/locust_tests/demo_locusts.yml')
locust_tests = prepare_locust_tests(path)
self.assertEqual(len(locust_tests), 2 + 3)
name_list = [
"create user 1000 and check result.",
"create user 1001 and check result."
]
self.assertIn(locust_tests[0]["config"]["name"], name_list)
self.assertIn(locust_tests[4]["config"]["name"], name_list)