Giter VIP home page Giter VIP logo

Comments (6)

brookshi avatar brookshi commented on July 30, 2024 1

非常好的需求,非常感谢,我也有些这方面的想法,打算是让每个项目在server可以有个自己的文件夹,功能上加 一个pre request script,然后可以在这里或test里保存返回的结果到文件夹也可以打开这个文件夹里的结果,还可以人工上传一些初始参数文件到这个文件夹,然后在脚本里打开取值,做到这点的话,上面的这些需求应该就可以做到了

from hitchhiker.

gumutianqi avatar gumutianqi commented on July 30, 2024

@brookshi
完美的理解,做到这点那 hitchhiker 就真的健壮了,期待动态参数功能的到来;
可惜我不会Node和Go,我主要做Java架构和交互设计,不然可以提交一些pull request,不过可以一起讨论数据结构存储获取等等设计和提供交互体验优化建议;

from hitchhiker.

brookshi avatar brookshi commented on July 30, 2024

嗯,争取尽快能做出来,非常感谢你的建议

from hitchhiker.

gumutianqi avatar gumutianqi commented on July 30, 2024

今天又想到一个点,在 Send 某个 API 接口的时候,其中的动态参数,应该可以直接读取该 Collection 下的另外一个接口的返回结果中的数据;

这样接口与接口直接就形成自动的调用链路了,不需要特殊干预;


举个实用场景:获取用户信息的 API,参数里面需要登录成功之后的 Token 参数;

两种实现方式

  1. 先点击调用 /login 来获取 token,在 Test 里面写脚本将 token 存下来,提供获取函数;然后再去调用/user/info 这是可以使用已经有的函数直接获取三个接口存下来的 token;

  2. 当然还有另一种更加便捷的方式,直接调用/user/info,发现参数里面有依赖另一个接口的结果,自动去调用依赖的接口,取得返回结果,读取结果直接给当前接口使用;


我觉得两种方式后面都需要考虑实现,场景不同:

第一种实现方式主要用在需要先初始化一些必要的数据到内存,或者大量动态参数存储文件的情况,然后在其他接口里面直接调用函数获取文件内容进行使用;主要是压测的场景和自动化测试里面边界测试的场景会用到;

第二种实现方式就是平时使用,我添加一个新接口,直接在script里面写这个接口的哪个参数依赖其他哪个接口;


这两种方式分别支持了 平时接口验证和测试使用单一接口压测全链路依赖压测三种自动化测试的需求,perfect !!!

from hitchhiker.

brookshi avatar brookshi commented on July 30, 2024
动态参数,应该可以直接读取该 Collection 下的另外一个接口的返回结果中的数据

这一点也就是第一种实现方式用上面说的应该是可以做到的吧
挺有想法的是第2种实现方式,自动调用依赖接口,不过有个问题:

在script里面写这个接口的哪个参数依赖其他哪个接口

这个其实比较难指定依赖的接口的,毕竟接口的名字可以是一样的,唯一标识符是guid,这个可读性太差。
不过倒是可以把这个功能做到UI上,直接选择已有的接口,这样做的好处大概是本来要点两次send,现在点一次就可以

from hitchhiker.

brookshi avatar brookshi commented on July 30, 2024

@gumutianqi
兄弟,这个在0.4版本已经做好,可以查看下,文档

from hitchhiker.

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.