mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-11 02:39:46 +08:00
feat: make locusts as httprunner plugin
This commit is contained in:
@@ -2,10 +2,9 @@ import os
|
||||
import re
|
||||
import shutil
|
||||
import time
|
||||
import unittest
|
||||
|
||||
from httprunner import exceptions, loader, parser
|
||||
from httprunner.api import HttpRunner, prepare_locust_tests
|
||||
from httprunner.api import HttpRunner
|
||||
from tests.api_server import HTTPBIN_SERVER
|
||||
from tests.base import ApiServerUnittest
|
||||
|
||||
@@ -788,18 +787,3 @@ class TestApi(ApiServerUnittest):
|
||||
results.records[1]["name"],
|
||||
"create user and check result."
|
||||
)
|
||||
|
||||
|
||||
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)
|
||||
|
||||
0
tests/test_plugins/__init__.py
Normal file
0
tests/test_plugins/__init__.py
Normal file
19
tests/test_plugins/test_locusts.py
Normal file
19
tests/test_plugins/test_locusts.py
Normal file
@@ -0,0 +1,19 @@
|
||||
import os
|
||||
import unittest
|
||||
|
||||
from httprunner.plugins.locusts 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)
|
||||
Reference in New Issue
Block a user