[英]How to make @Before of cucumber restricted for only one feature file?
I am using API testing and selenium both in one framework. 我在一个框架中同时使用API测试和硒。 I added @Before of cucumber to open a browser but for api testing i don't need to open browser.
我添加了@Before of Cucumber打开浏览器,但是对于api测试,我不需要打开浏览器。 But its opening for both UI and API.
但是它同时针对UI和API开放。 How should i restrict so that browser doesn't open up for api?
我应该如何限制浏览器才能使用api? @Before is opening browser for api also which i don't need.
@Before正在打开我不需要的API浏览器。
You can use tagged hooks on the Before hook 您可以在Before钩子上使用标记的钩子
@Before("not @API")
public void before() {
....
}
Add the tag @API to the feature file with api senarios. 使用api senarios将标签@API添加到功能文件中。
@API
Feature: api feature file
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.