本文整理匯總了Java中cucumber.api.Scenario.getSourceTagNames方法的典型用法代碼示例。如果您正苦於以下問題:Java Scenario.getSourceTagNames方法的具體用法?Java Scenario.getSourceTagNames怎麽用?Java Scenario.getSourceTagNames使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cucumber.api.Scenario
的用法示例。
在下文中一共展示了Scenario.getSourceTagNames方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: handleError
import cucumber.api.Scenario; //導入方法依賴的package包/類
public static void handleError(String url, String login, String password, Scenario scenario) throws Exception {
String issueId = "";
for(String tag : scenario.getSourceTagNames()) {
if (tag.contains("SAM-")) {
issueId = tag.substring(1);
break;
}
}
if (issueId.equals("")) {
return;
}
CredentialsProvider provider = new BasicCredentialsProvider();
UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(login, password);
provider.setCredentials(AuthScope.ANY, credentials);
HttpClient client = HttpClientBuilder.create().setDefaultCredentialsProvider(provider).build();
URI uri = UriBuilder.fromUri(url)
.path("/rest/api/2/issue/" + issueId).build();
String status = "Passed";
if (scenario != null && scenario.isFailed()) {
status = "Failed";
}
HttpPut request = new HttpPut(uri);
HttpEntity entity = new StringEntity("{\"fields\":{\"customfield_10007\": \"" + status + "\"}}");
request.setEntity(entity);
request.addHeader("Content-Type", "application/json");
HttpResponse response = client.execute(request);
client.getConnectionManager().shutdown();
}
示例2: updateTestDetails
import cucumber.api.Scenario; //導入方法依賴的package包/類
/**
* This method captures the GroupName, TestID and TestDescription details of each testcase under execution
* @param scenario
*/
private void updateTestDetails(Scenario scenario){
String featureScenario = scenario.getName();
for(String tag : scenario.getSourceTagNames()){
groupName = groupName + " " + tag.substring(0);
System.out.println("Tag: " + tag);
}
if (featureScenario.contains("<") && featureScenario.contains(">")){
this.testID = featureScenario.substring(
featureScenario.indexOf("<") + 1,
featureScenario.indexOf(">"));
this.testDescription = featureScenario.substring(0, featureScenario.indexOf("<"));//starting from index 1 to skip @ sign of tags
}
System.out.println("Complete Scenario is :-" +featureScenario);
System.out.println("Test Description is:- "+ this.testDescription);
System.out.println("Group Name is:- "+ this.groupName);
System.out.println("============================================================================================");
}
示例3: getTestExecutionControllerInstance
import cucumber.api.Scenario; //導入方法依賴的package包/類
public TestExecutionController getTestExecutionControllerInstance(Scenario scenario, String projectName)
throws Throwable {
baseBrowser = Constants.getProperty("browser") != null ? BROWSER.valueOf(Constants.getProperty("browser"))
: null;
baseEnv = Constants.getProperty("environment") != null
? ENVIRONMENT.valueOf(Constants.getProperty("environment")) : null;
if (scenario != null && projectName != null) {
if (BaseStepDef.scenario == null) {
BaseStepDef.scenario = scenario;
}
sourceTags = scenario.getSourceTagNames();
for (String token : sourceTags) {
token = token.replace("@", "");
if (mode == null && token.equals(TestExecutionController.SEQUENTIAL)) {
mode = TestExecutionController.SEQUENTIAL;
} else if (mode == null && token.equals(TestExecutionController.PARALLEL)) {
mode = TestExecutionController.PARALLEL;
} else if (baseBrowser == null && token.equals(TestExecutionController.BROWSER.CHROME.name())) {
baseBrowser = TestExecutionController.BROWSER.CHROME;
} else if (baseBrowser == null && token.equals(TestExecutionController.BROWSER.FIREFOX.name())) {
baseBrowser = TestExecutionController.BROWSER.FIREFOX;
} else if (baseBrowser == null && token.equals(TestExecutionController.BROWSER.IE.name())) {
baseBrowser = TestExecutionController.BROWSER.IE;
} else if (baseEnv == null && token.equals(TestExecutionController.ENVIRONMENT.QA.name())) {
baseEnv = TestExecutionController.ENVIRONMENT.QA;
} else if (baseEnv == null && token.equals(TestExecutionController.ENVIRONMENT.STAGING.name())) {
baseEnv = TestExecutionController.ENVIRONMENT.STAGING;
} else if (baseEnv == null && token.equals(TestExecutionController.ENVIRONMENT.PROD.name())) {
baseEnv = TestExecutionController.ENVIRONMENT.PROD;
}
}
if (baseUrl == null) {
baseUrl = Constants.getProperty(projectName + "." + baseEnv);
}
if (mode == null) {
mode = TestExecutionController.SEQUENTIAL;
}
}
if (BaseStepDef.testExecController == null) {
BaseStepDef.testExecController = new TestExecutionController(baseBrowser, baseUrl);
} else {
if (TestExecutionController.driver == null) {
BaseStepDef.testExecController.setBrowser(baseBrowser);
}
if (testExecController.baseUrl == null) {
BaseStepDef.testExecController.setBaseUrl(baseUrl);
}
}
return testExecController;
}
示例4: before
import cucumber.api.Scenario; //導入方法依賴的package包/類
@Before
public void before(Scenario scenario) throws Exception {
if (scenario.getSourceTagNames() == null
|| !scenario.getSourceTagNames().contains("@dbunit"))
DBUnitManager.getInstance().setUp();
}
示例5: after
import cucumber.api.Scenario; //導入方法依賴的package包/類
@After
public void after(Scenario scenario) throws Exception {
if (scenario.getSourceTagNames() == null
|| !scenario.getSourceTagNames().contains("@dbunit"))
DBUnitManager.getInstance().tearDown();
}
示例6: isTagged
import cucumber.api.Scenario; //導入方法依賴的package包/類
private boolean isTagged(Scenario scenario) {
Collection<String> tags = scenario.getSourceTagNames();
return tags.contains(TAG);
}
示例7: isTaggedAsNotImportant
import cucumber.api.Scenario; //導入方法依賴的package包/類
private boolean isTaggedAsNotImportant(Scenario scenario) {
Collection<String> tags = scenario.getSourceTagNames();
return tags.contains(customTAG);
}
示例8: ScenarioDTO
import cucumber.api.Scenario; //導入方法依賴的package包/類
public ScenarioDTO(Scenario scenario) {
status = scenario.getStatus();
sourceTagNames = new ArrayList<String>(scenario.getSourceTagNames());
failed = scenario.isFailed();
name = scenario.getName();
}