我有2个获取API,以获取所有文件夹,一个在Onprem上,另一个在云上。因此,我已经使用了JSON提取器,并提取了文件夹ID和标题(folderId,fold_title,cld_folderid,cld_fold_title),现在我必须在另一个get api中通过此文件夹ID for onPrem和cloud,以便我可以获得内容的内容存在在文件夹中,然后比较以检查内容是否相同。
因此,我已经使用每个文件夹中的for for Controller来获取每个文件夹中的内容并嵌套了API,云福拉赫控制器在每个控制器的内部内部ost onprem for
foreach参数是这样的:
input variable:folderId:foldererid(如提取(提取已提取 已提取)使用JSON Extractor)
启动索引:0
循环的Indes:$ {folderID_Matchnr}
输出varibale是folderidd,
然后使用get api来获取该文件夹中所有内容的ID和标题(使用JSON提取器提取)。
要在Onprem上的文件夹中获取内容,URL就像:
; get api a for for Controler的每个控制器都插入
与上述控制器详细信息的云相同的云和输出ID是cld_folderidd,
以在云上的文件夹中获取内容。
https://abc.cloud.com/jul
我提取了ID并提取了Titter,因此可以使用Bean Shell断言对其进行比较。
在执行脚本第1文件夹时,正在对云中的所有文件夹进行检查,主要问题是我只想将ONPREM的第一个文件夹与云的第一个文件夹和云的第一个文件夹和第二个云进行比较使用云的第二个文件夹,或者仅以相同的标题名称比较文件夹。
因此,在Get文件夹内容请求请求之前,我已经在云中插入了一个IF控制器。 if控制器条件就是这样:$ {__ jexl3(“ $ {fold_title_all}” ==“ $ {cloud_fold_title_all}”)}
在这里我无法使用文件夹ID检查,因为它不是在云中固定的,随机数将是一个随机号码生成和分配的将与OnPrem文件夹ID
但仍然不起作用,再次将一个onprem文件夹与云上的所有文件夹进行比较,请建议我一些东西,以便我只检查一个文件夹Onprem的文件夹仅在云上有一个文件夹!!
I have 2 get api's to get all the folders present, one on onprem and other on cloud. So I have used the json extractor and have extracted the folder id's and titles for both(folderid, fold_title, cld_folderid, cld_fold_title) , now I have to pass this folder id in another get api for both onprem and cloud so I could get the contents present in the folders and then compare to check if contents are same.
So I have used the foreach controller each for onprem and cloud get api to get contents in each folder and have nested them, cloud forach controller is inside onprem for each controller
The onprem foreach parameters are something like this:
input variable: folderid (as extracted using json extractor)
start index : 0
end indes of loop : ${folderid_matchNr}
output varibale is folderidd
Then a get api is used to get the id and title(extractesd using json extractor) of all the content in that respective folder.
to get contents in a folder on onprem the url is something like:
https://abc.onprem.com/${folderidd}
then inside this for each controller after the get api a foreach controller for cloud is inserted
for cloud same as above foreach controller details and output id is cld_folderidd
to get contents in a folder on cloud the url is something like:
https://abc.cloud.com/${cld_folderidd}
inside this http request I have extracted the id and tittle so I could compare them using bean shell assertion.

While executing the script 1st folder on onprem is being checked against all the folders in cloud, the main problem is that I just wanted to compare the first folder of onprem with 1st folder of cloud and 2nd cloud of onprem with 2nd folder of cloud or only compare the folders with same title name.
So I have inserted a if controller in cloud for each controller before the get folder contents request. and the if controller condition is as such : ${__jexl3("${fold_title_ALL}"=="${cloud_fold_title_ALL}")}
here I can't check with folder id as it is not fixed in cloud a random number will be generated and assigned which will be different from onprem folder id

But still this isn't working, again one onprem folder is being compared with all folders on cloud please suggest me something so that I could check only one folder of onprem with one folder on cloud only!!
发布评论
评论(1)
您无需使用“嵌套” foreach控制器,需要使用单个foreach控制器。
为了获得云的相关变量,您可以使用 __ intsum(__ intsum() __ v()函数组合,即类似的东西:
更多信息:这是组合多个jmeter variables的方法
也请告知使用beanshell是一种表演的某种形式的抗性模式,请考虑使用 jsr223 sustertion 和grovy 和Grovy 和Grovy。
You don't need to use "nested" ForEach Controller, you need to use single ForEach Controller.
In order to get the relevant variable for cloud you can use __intSum() and __V() functions combination, i.e. something like:
More information: Here’s What to Do to Combine Multiple JMeter Variables
Also be informed that using Beanshell is some form of a performance anti-pattern, consider using JSR223 Assertion and Groovy instead.