本文整理汇总了Java中cucumber.api.java.Before类的典型用法代码示例。如果您正苦于以下问题:Java Before类的具体用法?Java Before怎么用?Java Before使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Before类属于cucumber.api.java包,在下文中一共展示了Before类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: prepare
import cucumber.api.java.Before; //导入依赖的package包/类
@Before
public void prepare() {
pugTSDB = new PugTSDB("/tmp/pug-rollup-test", "test", "test");
repositories = Stream.of(pugTSDB.getClass().getDeclaredFields())
.filter(field -> {
field.setAccessible(true);
return field.isAccessible();
})
.filter(field -> field.getType().equals(Repositories.class))
.map(field -> {
try {
return (Repositories) field.get(pugTSDB);
} catch (IllegalAccessException e) {
return null;
}
})
.findFirst()
.get();
}
示例2: prepare
import cucumber.api.java.Before; //导入依赖的package包/类
@Before
public void prepare() {
pugTSDB = new PugTSDB("/tmp/pug-rollup-test", "test", "test");
repositories = Stream.of(pugTSDB.getClass().getDeclaredFields())
.filter(field -> {
field.setAccessible(true);
return field.isAccessible();
})
.filter(field -> field.getType().equals(Repositories.class))
.map(field -> {
try {
return (Repositories) field.get(pugTSDB);
} catch (IllegalAccessException e) {
return null;
}
})
.findFirst()
.get();
executionInstant = Instant.now();
}
示例3: setUpScenario
import cucumber.api.java.Before; //导入依赖的package包/类
@Before()
public static void setUpScenario(Scenario scenario) throws TechnicalException {
logger.debug("setUpScenario {} scenario.", scenario.getName());
if (Context.getCurrentScenarioData() == 0) {
// Retrieve Excel filename to read
String scenarioName = System.getProperty("excelfilename") != null ? System.getProperty("excelfilename") : getFirstNonEnvironmentTag(scenario.getSourceTagNames());
Context.setScenarioName(scenarioName);
Context.getDataInputProvider().prepare(Context.getScenarioName());
Context.getDataOutputProvider().prepare(Context.getScenarioName());
Context.startCurrentScenario();
}
// Increment current Excel file line to read
Context.goToNextData();
Context.emptyScenarioRegistry();
Context.saveValue(Constants.IS_CONNECTED_REGISTRY_KEY, String.valueOf(Auth.isConnected()));
Context.setCurrentScenario(scenario);
new Result.Success<>(Context.getScenarioName(), Messages.getMessage(SUCCESS_MESSAGE_BY_DEFAULT));
}
示例4: beforeClass
import cucumber.api.java.Before; //导入依赖的package包/类
@Before
public static void beforeClass() throws Exception {
/*
* This runs under maven, and I'm not sure how else to figure out the target directory from code..
*/
if (validator == null) {
/* TODO STU3
FhirInstanceValidator instanceValidator = new FhirInstanceValidator();
validator.registerValidatorModule(instanceValidator);
IValidationSupport valSupport = new CareConnectValidation();
ValidationSupportChain support = new ValidationSupportChain(new DefaultProfileValidationSupport(), valSupport);
instanceValidator.setValidationSupport(support);
*/
}
else {
// ourLog.info("START - CALLED NOT Creating Server");
}
}
示例5: beforeFeature
import cucumber.api.java.Before; //导入依赖的package包/类
@Before(order=4)
public void beforeFeature(Scenario scenario) throws SQLException, ClassNotFoundException {
logger.info("Start scenario: " + scenario.getName());
//To run the after hook methods in the last scenario of the features
currentFeature = scenario.getId().split(";")[0];
System.out.println(currentFeature);
if (!currentFeature.equals(lastFeature)) {
executeAfterHookMethod();
lastFeature = currentFeature;
featureFlag = false;
}
}
示例6: before
import cucumber.api.java.Before; //导入依赖的package包/类
@Before
public void before(){
try {
TestNGBase.jdiSetUp();
getDriverFactory().setDriverPath("C:/Selenium");
initFromProperties();
//Assert.noScreenOnFail();
WebSite.init(EpamJDISite.class);
homePage.open();
login.submit(User.DEFAULT_USER);
logger.info("Run Tests");
Verify.getFails();
} catch (Exception e) {
e.printStackTrace();
}
}
示例7: shellSetup
import cucumber.api.java.Before; //导入依赖的package包/类
@Before(order = 10, value = "@shell")
public void shellSetup() throws IOException, InterruptedException {
commonspec.getLogger().info("Stratio Streaming shell setup");
String streamingHome = System.getProperty("STRATIO-STREAMING_SHELL_HOME", "../stratio-streaming/");
File shell = new File(streamingHome);
ProcessBuilder pb = new ProcessBuilder(shell.getAbsolutePath());
Map<String, String> env = pb.environment();
env.put("SHELL_OPTS", System.getProperty("SHELL_OPTS", ""));
Process process = pb.start();
Expect expect = new ExpectBuilder().withInputs(process.getInputStream())
.withInputFilters(removeNonPrintable(), removeColors()).withOutput(process.getOutputStream())
// .withEchoInput(System.out).withEchoOutput(System.out)
.withTimeout(20, TimeUnit.SECONDS)
// .withErrorOnTimeout(true)
.build();
Thread.sleep(1000);
commonspec.setShellIface(expect);
}
示例8: streamingApiSetup
import cucumber.api.java.Before; //导入依赖的package包/类
@Before(order = 20, value = "@api")
public void streamingApiSetup() {
commonspec.getLogger().info("Stratio Decision API setup");
try {
commonspec.getLogger().info("Starting Stratio Decision factory on {}:{}, {}:{}",
commonspec.getKAFKA_HOST(), commonspec.getKAFKA_PORT(), commonspec.getZOOKEEPER_HOST(),
commonspec.getZOOKEEPER_PORT());
IStratioStreamingAPI stratioStreamingAPI = StratioStreamingAPIFactory.create().initializeWithServerConfig(
commonspec.getKAFKA_HOST(), commonspec.getKAFKA_PORT(), commonspec.getZOOKEEPER_HOST(),
commonspec.getZOOKEEPER_PORT(), commonspec.getZOOKEEPER_PATH());
commonspec.setStratioStreamingAPI(stratioStreamingAPI);
} catch (StratioStreamingException e) {
commonspec.getLogger().error("Got Exception on connecting to Stratio Decision", e);
fail("Unable to create Stratio Streaming Factory");
}
}
示例9: before
import cucumber.api.java.Before; //导入依赖的package包/类
@Before
public void before(){
try {
TestNGBase.jdiSetUp();
getDriverFactory().setDriverPath("C:\\Selenium");
initFromProperties();
//Assert.noScreenOnFail();
Init(EpamJDISite.class);
homePage.open();
login.submit(User.DEFAULT_USER);
logger.info("Run Tests");
Verify.getFails();
} catch (Exception e) {
e.printStackTrace();
}
}
示例10: setup
import cucumber.api.java.Before; //导入依赖的package包/类
@Before("@rest")
public void setup() {
if (config == null) {
config = new CompositeConfiguration();
config.addConfiguration(new SystemConfiguration());
try {
config.addConfiguration(new PropertiesConfiguration(CONFIG_FILE));
} catch (ConfigurationException e) {
logger.error("Can not load properties file " + CONFIG_FILE);
e.printStackTrace();
}
}
}
示例11: beforeScenario
import cucumber.api.java.Before; //导入依赖的package包/类
@Before
public void beforeScenario( Scenario scenario ) throws Exception
{
log( "***************************************************************************");
log( "Executing Scenario : " + scenario.getName() );
log( "***************************************************************************");
//Read all parameters from preferences.properties and make it available to the SessionContextManager
Map allParams = new MyPropertyReader("preferences.properties").getAllParams();
SessionContextManager.registerParameters(MyContextSupport.getParameters(allParams));
//attach the Spring Application Context to the SessionContextManager
SessionContextManager.attachSpringContext(ctx);
//Get the object of WebDriverWebController(gives access to all WebUI actions)
WebDriverWebController webController = (WebDriverWebController)ctx.getBean("webDriverWebController");
//Making driver available to the WebController
webController.setDriver(DriverFactory.getDriver());
//making webController available to SessionContextManager
SessionContextManager.setController(webController);
//Lunches the driver
SessionContextManager.getInstance().setAttribute( "execution_type", "browser" );
getDriver().manage().window().maximize();
getDriver().manage().deleteAllCookies();
}
示例12: beforeFeatures
import cucumber.api.java.Before; //导入依赖的package包/类
@Before
public void beforeFeatures() {
if (!loadedOnce) {
try {
loadConfiguration();
loadedOnce = true;
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(String.format("You do not have a configuration file in `%s`. Please specify one there or use -DcukeConfig to manually specify one.", getConfigFilePath()), e);
}
}
}
示例13: setup
import cucumber.api.java.Before; //导入依赖的package包/类
@Before
public void setup() throws JsonParseException, JsonMappingException, IOException {
this.acsitSetUpFactory.setUp();
this.acsUrl = this.acsitSetUpFactory.getAcsUrl();
this.zone1Headers =this.acsitSetUpFactory.getZone1Headers();
this.acsAdminRestTemplate=this.acsitSetUpFactory.getAcsZoneAdminRestTemplate();
}
示例14: setup
import cucumber.api.java.Before; //导入依赖的package包/类
@Before
public void setup() throws JsonParseException, JsonMappingException, IOException {
this.acsitSetUpFactory.setUp();
this.acsUrl = this.acsitSetUpFactory.getAcsUrl();
this.zone1Headers = this.acsitSetUpFactory.getZone1Headers();
this.acsZone1Template = this.acsitSetUpFactory.getAcsZoneAdminRestTemplate();
this.acsZone2Template = this.acsitSetUpFactory.getAcsZone2AdminRestTemplate();
this.zone1Name = this.acsitSetUpFactory.getZone1().getName();
this.zone2Name = this.acsitSetUpFactory.getZone2().getName();
}
示例15: beforeScenarioIntegrationScope
import cucumber.api.java.Before; //导入依赖的package包/类
@Before(value={"@integration"}, order=100)
public void beforeScenarioIntegrationScope() {
org.apache.log4j.PropertyConfigurator.configure("logging.properties");
DomainAppSystemInitializer.initIsft();
before(ScenarioExecutionScope.INTEGRATION);
}