简体   繁体   English

在SOAPUI中设置默认元素

[英]Setting a default element in SOAPUI

I've been using SOAPUI a lot lately and noticed that there are some elements I want to set for all request, such as an API key, or a date range. 我最近一直在使用SOAPUI,并且注意到我想为所有请求设置一些元素,例如API密钥或日期范围。

Is there a way to automatically do this? 有没有一种方法可以自动执行此操作?

example: Every request begins with: ? 示例:每个请求均以:开头

Is there a way to automatically fill in the api key for every request? 有没有一种方法可以为每个请求自动填写api密钥?

thanks. 谢谢。

I think the answer is No. 我认为答案是否定的。

But you can try playing with defining properties. 但是您可以尝试使用定义属性。 You can set properties at project level and then use the property everywhere you need. 您可以在项目级别设置属性,然后在所需的任何地方使用该属性。 It is not automated - you have to use the property correctly everywhere you need it. 它不是自动的-您必须在需要的任何地方正确使用该属性。

In the project tree on the left you see all your WSDLs and its operations. 在左侧的项目树中,您会看到所有WSDL及其操作。 Right click on an operation and choose New request . 右键单击一个操作,然后选择新请求

Open the new request and set the default properties you want. 打开新请求并设置所需的默认属性。 Now you have two possibilities. 现在您有两种可能性。

Add to TestCase 添加到TestCase

Right click on the request and choose that option. 右键单击该请求,然后选择该选项。 Then you can choose the TestCase to which you want to add the request. 然后,您可以选择要将请求添加到的TestCase。

Copy to TestRequests 复制到TestRequests

Right click on the request and choose that option. 右键单击该请求,然后选择该选项。 Now you can choose existing TestRequests to which you want to add the values of the given request. 现在,您可以选择要将给定请求的值添加到的现有TestRequest。 I haven't used that option till now. 到目前为止,我还没有使用过该选项。 You have to try if it works as expected. 您必须尝试它是否按预期工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM