當前位置: 首頁>>代碼示例>>Java>>正文


Java Scenario.getSourceTagNames方法代碼示例

本文整理匯總了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();
}
 
開發者ID:mkolisnyk,項目名稱:0686OS,代碼行數:30,代碼來源:JiraUtils.java

示例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("============================================================================================");
}
 
開發者ID:MastekLtd,項目名稱:SwiftLite,代碼行數:24,代碼來源:StepDefinitions.java

示例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;
}
 
開發者ID:saiscode,項目名稱:kheera,代碼行數:51,代碼來源:BaseStepDef.java

示例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();
}
 
開發者ID:awltech,項目名稱:easycukes,代碼行數:7,代碼來源:DBUnitStepdefs.java

示例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();
}
 
開發者ID:awltech,項目名稱:easycukes,代碼行數:7,代碼來源:DBUnitStepdefs.java

示例6: isTagged

import cucumber.api.Scenario; //導入方法依賴的package包/類
private boolean isTagged(Scenario scenario) {
    Collection<String> tags = scenario.getSourceTagNames();
    return tags.contains(TAG);
}
 
開發者ID:Stratio,項目名稱:bdt,代碼行數:5,代碼來源:HookGSpec.java

示例7: isTaggedAsNotImportant

import cucumber.api.Scenario; //導入方法依賴的package包/類
private boolean isTaggedAsNotImportant(Scenario scenario) {
    Collection<String> tags = scenario.getSourceTagNames();
    return tags.contains(customTAG);
}
 
開發者ID:Stratio,項目名稱:bdt,代碼行數:5,代碼來源:HookGSpec.java

示例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();
}
 
開發者ID:viltgroup,項目名稱:minium,代碼行數:7,代碼來源:ScenarioDTO.java


注:本文中的cucumber.api.Scenario.getSourceTagNames方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。