从Taurus的yaml文件传递变量到JMeter脚本,用于切换JDBC连接。

huangapple go评论63阅读模式
英文:

Passing a variable from Taurus yaml file to Jmeter script to switch JDBC connection

问题

我目前有一个 JMeter 脚本,我想通过在运行时通过 taurus yaml 传递变量来切换脚本中的 JDBC 连接。

目标是通过在 yaml 中设置变量来切换环境。

根据 Taurus 提供的指南,我在 yaml 文件的设置部分创建了一个环境变量,如下所示:

> settings:
env:
ENV_VARIABLE: randomvariabletest

然后使用这个变量,在 JMeter 脚本中调用如下:

从Taurus的yaml文件传递变量到JMeter脚本,用于切换JDBC连接。

我希望 JDBC 请求能够调用我命名为 randomvariabletest 的 JDBC 连接。我原以为 JDBC 请求会读取我传递的值。

从Taurus的yaml文件传递变量到JMeter脚本,用于切换JDBC连接。

但实际情况并非如此,因为我遇到了以下错误:

java.lang.IllegalArgumentException: 在 GET MAX ORDER ID 中变量名称不得为空

我在这里做错了什么?帮助将不胜感激。

英文:

I currently have a jmeter script which I would like to switch it's jdbc connections in the script, by passing a variable at runtime through the taurus yaml.

The aim is to switch environment by setting the variable in the yaml.

Using the guide provided by Taurus, I created an environment variable under settings in the yaml file as follows:

> settings:
env:
ENV_VARIABLE: randomvariabletest

Then using the variable, I call on that in the Jmeter script as follows

从Taurus的yaml文件传递变量到JMeter脚本,用于切换JDBC连接。

I want the JDBC request to then call the JDBC connection which I have named as randomvariabletest. I was expecting that the JDBC request would read the value which I passed in.

从Taurus的yaml文件传递变量到JMeter脚本,用于切换JDBC连接。

This doesn't work as expected as I am getting the following error:

java.lang.IllegalArgumentException: Variable Name must not be null in GET MAX ORDER ID

What am I doing wrong here, any help would be appreciated.

答案1

得分: 2

你正在使用错误的函数,__P() 函数 用于读取 JMeter 属性,如果你计划使用 JMeter 属性进行参数化,你需要按照 本章节 中的说明操作。

如果你计划继续使用环境变量,你可以选择:

英文:

You're using wrong function, __P() function reads a JMeter Property and if you plan to use JMeter Properties for parameterization you need to follow this chapter

If you plan to continue using environment variables you either need to:

答案2

得分: -1

连接池的变量名JDBC连接配置元素中必须与[JDBC连接配置中声明的池的变量名]相匹配**2。**

连接和JDBC请求是使用此变量连接的。

从Taurus的yaml文件传递变量到JMeter脚本,用于切换JDBC连接。

英文:

Variable Name for connection pool in JDBC Connection Configuration elements must match with the Variable Name of Pool declared in JDBC Connection Configuration in JDBC Request

Connections and JDBC Requests are connected using this variable.

从Taurus的yaml文件传递变量到JMeter脚本,用于切换JDBC连接。

huangapple
  • 本文由 发表于 2020年9月16日 06:49:52
  • 转载请务必保留本文链接:https://go.coder-hub.com/63910840.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定