gpt4 book ai didi

Is there any way to reassign a value to already defined variable in Karate framework?(有没有办法给空手道框架中已经定义的变量重新赋值?)

转载 作者:bug小助手 更新时间:2023-10-25 23:36:57 27 4
gpt4 key购买 nike



I have a scenario as below: -

我有一个设想如下:


Scenario: Reassign variable
* def name = "Amod"
* print "Hello " + name
* name = "Animesh"
* print "Hello " + name

It gives error below-

它给出以下错误-


* name = "Animesh"
no step-definition method match found for: name = "Animesh"

To make it work I need to use "def" keyword again. A variable is meant to be declared once and reused & reassigned whenever required. Is it memory efficient to define it every time?

要使其正常工作,我需要再次使用“def”关键字。变量应该声明一次,并在需要时重新使用和重新分配。每次定义它是否都会节省内存?


更多回答
优秀答案推荐

Karate allows you to "overwrite" a variable using def. You will see a warning in the console. We don't see any memory issues.

Karate允许你使用def“覆盖”一个变量。你会在控制台看到一个警告。我们没发现任何记忆问题。


更多回答

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com