考虑我有以下特征文件:调用从另一个特点一个特征文件中黄瓜
Login.feature
Feature: Login on website
Scenario: Login verification on site
Given Navigate to site login page
When User enters username 'admin1'
And User enters password 'admin1'
And User clicks on login button
Then User should not be able to log in successfully
Home.feature
Feature: Welcome Page Verification
Scenario: Verify the page that comes after login
Given Login is successfully done
When The page after login successfully appears
Then The test is done
在Home.feature文件,我需要先执行Login.feature然后调用home.feature。所以当我从亚军测试中执行回家时,它将依次执行登录和回家。
RunnerTest.java
import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
@RunWith(Cucumber.class)
@CucumberOptions(strict = false, features = {
"src/test/resources/Features/Home.feature",
}, glue = { "tests" }, plugin = "html:target/cucumber-reports", format = { "pretty",
"json:target/cucumber.json" }, tags = { "[email protected]" })
public class RunnerTest {}
感谢&问候, MEGHA