mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-11 18:11:21 +08:00
Merge pull request #1364 from billduan/fix_sql_response_print
fix: support None/dict/list format when printing sql response
This commit is contained in:
BIN
examples/data/sqlite.db
Normal file
BIN
examples/data/sqlite.db
Normal file
Binary file not shown.
36
examples/sql/test_sql_demo.py
Normal file
36
examples/sql/test_sql_demo.py
Normal file
@@ -0,0 +1,36 @@
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from httprunner.database.engine import DBEngine
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent))
|
||||
|
||||
from httprunner import HttpRunner, Config, Step, RunSqlRequest # noqa:E402
|
||||
|
||||
|
||||
class TestCaseDemoSqlite(HttpRunner):
|
||||
config = Config("run sqlite demo")
|
||||
|
||||
teststeps = [
|
||||
Step(
|
||||
RunSqlRequest("执行一个sqlite demo")
|
||||
.fetchmany("select* from student;", 5)
|
||||
.extract()
|
||||
.with_jmespath("[0].name", "name")
|
||||
.validate()
|
||||
.assert_equal(
|
||||
"[0]",
|
||||
{
|
||||
"id": 1,
|
||||
"name": "Jack",
|
||||
"fullname": {"first_name": "Jack", "last_name": "Tomson"},
|
||||
},
|
||||
)
|
||||
.assert_equal("[0].fullname.first_name", "Jack")
|
||||
)
|
||||
]
|
||||
|
||||
def test_start(self):
|
||||
eg = DBEngine(db_uri="sqlite:///../data/sqlite.db")
|
||||
self.with_db_engine(eg)
|
||||
super().test_start()
|
||||
Reference in New Issue
Block a user