Giter VIP home page Giter VIP logo

Comments (5)

yileye avatar yileye commented on May 18, 2024

问题已经解决,代码位置如下:

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.

debugtalk avatar debugtalk commented on May 18, 2024

@yileye 是这样的,因为YAML/JSON接口测试用例中,我们已经都有了host信息,因此在采用Locust执行测试的时候,其实是不需要再传入HOST的。只是Locust脚本中,又必须要填一个host,所以当时就搞了个作为占位符。

from httprunner.

debugtalk avatar debugtalk commented on May 18, 2024

拟打算修复为如下形式:

  • locusts 命令支持传入 --host/-H 参数;
  • 若传入该参数,该参数将覆盖YAML/JSON测试用例中的base_url
  • 若不传入该参数,就将读取YAML/JSON测试用例中的base_url,作为locustfile.py的host参数。

from httprunner.

yileye avatar yileye commented on May 18, 2024

@debugtalk 好的,这样的话能避免使用当中出现的一些不必要的异常,Locust有web和no web两种模式,是否都支持,因为想跑在跑接口的时候自动跑一些性能测试的东西

from httprunner.

debugtalk avatar debugtalk commented on May 18, 2024

@yileye webno-web都是支持的;总的来说,使用locusts命令相比于原生的locust命令,功能没有删减,locust命令能用的locusts都能用。

from httprunner.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.