I am using API testing and selenium both in one framework. I added @Before of cucumber to open a browser but for api testing i don't need to open browser. But its opening for both UI and API. How should i restrict so that browser doesn't open up for api? @Before is opening browser for api also which i don't need.
You can use tagged hooks on the Before hook
@Before("not @API")
public void before() {
....
}
Add the tag @API to the feature file with api senarios.
@API
Feature: api feature file
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.