[英]Karate UI testing: how to prevent browser closing at the end of Scenario
I am working on UI automated tests using Karate framework.我正在使用 Karate 框架进行 UI 自动化测试。 I am really enjoyng working with this great tool, but it's something that I'm trying to resolve for a while and can't find any solution.
我真的很喜欢使用这个很棒的工具,但这是我试图解决一段时间但找不到任何解决方案的问题。
I have a feature file with 3 scenarios and I want to open the browser and to make login only once , before all scenarios, and to be closed only after the last scenario is finished.我有一个包含3 个场景的功能文件,我想打开浏览器并在所有场景之前只登录一次,并且仅在最后一个场景完成后关闭。 In my case driver is started at separated login.feature file which is called from Background using 'callonce read('login.feature')' command.
在我的例子中,驱动程序是在单独的 login.feature 文件中启动的,该文件是使用“callonce read('login.feature')”命令从后台调用的。 I've seen somewhere that if driver is started before scenario.
我在某处看到,如果驱动程序在场景之前启动。 In my case it's not working.
就我而言,它不起作用。 What do I do wrong?
我做错了什么?
You can use this answer as a reference: https://stackoverflow.com/a/60581024/143475您可以使用此答案作为参考: https://stackoverflow.com/a/60581024/143475
So it is supposed to work if you create a feature and then call the other scenarios from that feature.因此,如果您创建一个功能然后从该功能调用其他场景,它应该可以工作。 Karate is designed to close the driver after a
Scenario
by default.空手道旨在默认情况下在
Scenario
后关闭驱动程序。
I also recommend that when you have a flow, don't try to split it into different Scenarios.我还建议当你有一个流程时,不要试图把它分成不同的场景。 Or you should be prepared to call different features from one Scenario.
或者您应该准备好从一个场景中调用不同的功能。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.