Comments (5)
问题已经解决,代码位置如下:
def gen_locustfile(testcase_file_path):
""" generate locustfile from template.
"""
locustfile_path = 'locustfile.py'
with codecs.open('ate/locustfile_template', encoding='utf-8') as template:
with codecs.open(locustfile_path, 'w', encoding='utf-8') as locustfile:
template_content = template.read()
template_content = template_content.replace("$HOST", "https://skypixel.com")
template_content = template_content.replace("$TESTCASE_FILE", testcase_file_path)
locustfile.write(template_content)
return locustfile_path
host没有根据用例中的host的动态传入
from httprunner.
@yileye 是这样的,因为YAML/JSON
接口测试用例中,我们已经都有了host信息,因此在采用Locust执行测试的时候,其实是不需要再传入HOST的。只是Locust脚本中,又必须要填一个host,所以当时就搞了个作为占位符。
from httprunner.
拟打算修复为如下形式:
- locusts 命令支持传入
--host/-H
参数; - 若传入该参数,该参数将覆盖
YAML/JSON
测试用例中的base_url
; - 若不传入该参数,就将读取
YAML/JSON
测试用例中的base_url
,作为locustfile.py
的host参数。
from httprunner.
@debugtalk 好的,这样的话能避免使用当中出现的一些不必要的异常,Locust有web和no web两种模式,是否都支持,因为想跑在跑接口的时候自动跑一些性能测试的东西
from httprunner.
@yileye web
和no-web
都是支持的;总的来说,使用locusts
命令相比于原生的locust
命令,功能没有删减,locust
命令能用的locusts
都能用。
from httprunner.
Related Issues (20)
- 参数驱动运行,报告展示不友好 HOT 1
- step name中同时引用变量和自定义方法存在bug
- debugtalk.py的方法中,打印日志不输出
- 断言自定义函数不支持中文参数
- 希望新增连接池解决测试机端口耗尽问题
- 如何获取响应时间,进行断言?4版本elapsed.microseconds这样写获取不到
- 转换.har失败 HOT 5
- 一键安装命令报错了 HOT 5
- hrp run 执行在 urlPath 最后添加 / ,接口返回 307 状态码,导致断言失败 HOT 1
- hrun 运行测试用了完毕之后,后台python进程仍然占用大量内存,没有退出 HOT 2
- header 中不能识别字典变量
- pytest运行测试用例,无法使用----alluredir产生报告 HOT 1
- 引用api时,提取access_token报 no attribute 'with_jmespath
- 发送post请求时,会自动给url最后加上/,这个bug能修复下嘛谢谢 HOT 3
- 期望yaml调用debugtalk中的自定义函数,支持关键字参数传参
- hrp 是否能支持step 运行次数 (times) 和失败重试(retry)
- go run出现大量function xxx is not found HOT 1
- rsa算法 HOT 1
- 性能测试并发数问题询问
- How can I do disable GA4 feature for executing error HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from httprunner.