简体   繁体   中英

Multiple classes inside step definition package in cucumber

I have a cucumber framework which is catering to API as well as UI feature files. So, I have 2 feature files one for API and the other for UI. Similarly, I have created 2 classes in my step definition folder one for UI and other for API. So the structure is something like below :

featureFiles

--feature file for API

--feature file for UI

stepDefinition

--stepDefAPI

--stepDefUI

TestRunner

--UITestRunner

--APITestRunner

gluecode for both are stepDefinition, however, if I run APITestRunner, it says Test Class not found in specific project. However, when i segregate my stepDefAPI in some other package and only leave stepDefUI in that package then it works correctly. I can infer that it is happening because both the classes are in same package, doesn't cucumber support this kind of structure ?

Cucumber will load the glue in the directory and subdirectories. If you want to use different step definitions for UI and for API, create two subdirectories in your stepDefinition package and provide each relevant directory to the relevant runner. Ie the UI directory to the UI runner and the API directory to the API runner.

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.

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