考慮我有以下特徵文件:調用從另一個特點一個特徵文件中黃瓜
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