cucumber.api.java.en.Given Java Examples

The following examples show how to use cucumber.api.java.en.Given. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GraphqlSteps.java    From pandaria with MIT License 5 votes vote down vote up
@Given("^variables: ([^\"]*)$")
public void graphqlVariablesFromFile(String file) throws IOException {
    String fileName = configuration.classpathFile(file);
    String graphqlVariables = expressions.evaluate(read(fileName));

    assertNotNull(graphqlVariables);
    assertFalse(graphqlVariables.isEmpty());
    graphql.variables(graphqlVariables);
}
 
Example #2
Source File: BuyingAndSellingSharesStepDefinitions.java    From bdd-trader with Apache License 2.0 5 votes vote down vote up
@Given("(\\w+) (\\w+) is a registered trader$")
public void a_registered_trader(String firstName, String lastName) {

    Actor trader = OnStage.theActorCalled(firstName);

    trader.attemptsTo(
            RegisterWithBDDTrader.asANewClient(Client.withFirstName(firstName)
                                                     .andLastName(lastName)
                                                     .andEmail(firstName + "@" + lastName + ".com"))
    );
}
 
Example #3
Source File: VariableDefinitionSteps.java    From pandaria with MIT License 4 votes vote down vote up
@Given("^var: ([^\"' ]*)=faker: ([^\"]*)$")
public void faker(String name, String expression) {
    variables.assign(name, configuration.faker().expression(expression));
}
 
Example #4
Source File: FeatureConfigurationSteps.java    From pandaria with MIT License 4 votes vote down vote up
@Given("^base uri: ([^\"]*)")
public void baseUri(String uri) {
    configuration.baseUri(expressions.evaluate(uri));
}
 
Example #5
Source File: JsonSchemaVerificationSteps.java    From pandaria with MIT License 4 votes vote down vote up
@Given("^verify: \\$\\{([^\"]*)} conform to:")
public void verifyJsonInVariableConformSchema(String expression, String schemaJson) throws IOException {
    validateJsonSchema(variables.get(expression), schemaJson);
}
 
Example #6
Source File: JsonSchemaVerificationSteps.java    From pandaria with MIT License 4 votes vote down vote up
@Given("^verify: \\$\\{([^\"]*)} conform to: ([^\"]*)")
public void verifyJsonInVariableConformSchemaFile(String expression, String file) throws IOException {
    validateJsonSchema(variables.get(expression), read(configuration.classpathFile(file)));
}
 
Example #7
Source File: JsonSchemaVerificationSteps.java    From pandaria with MIT License 4 votes vote down vote up
@Given("^verify: '([^\"]*)' conform to: ([^\"]*)")
public void verifyJsonConformSchemaFile(String path, String file) throws IOException {
    validateJsonSchema(actual.json(path), read(configuration.classpathFile(file)));
}
 
Example #8
Source File: NullableVerificationSteps.java    From pandaria with MIT License 4 votes vote down vote up
@Given("^verify: \\$\\{([^\"]*)} is null")
public void verifyVariableIsNull(String expression) {
    assertThat(variables.get(expression), nullValue());
}
 
Example #9
Source File: NullableVerificationSteps.java    From pandaria with MIT License 4 votes vote down vote up
@Given("^verify: '([^\"]*)' is not null")
public void verifyIsNotNull(String path) throws IOException {
    assertThat(actual.json(path), not(nullValue()));
}
 
Example #10
Source File: NullableVerificationSteps.java    From pandaria with MIT License 4 votes vote down vote up
@Given("^verify: '([^\"]*)' is null")
public void verifyIsNull(String path) throws IOException {
    assertThat(actual.json(path), nullValue());
}
 
Example #11
Source File: FeatureConfigurationSteps.java    From pandaria with MIT License 4 votes vote down vote up
@Given("^faker locale: ([^\"]*)")
public void fakerLocale(String locale) {
    configuration.fakerLocale(new Locale(locale));
}
 
Example #12
Source File: NullableVerificationSteps.java    From pandaria with MIT License 4 votes vote down vote up
@Given("^verify: \\$\\{([^\"]*)} is not null")
public void verifyVariableIsNotNull(String expression) {
    assertThat(variables.get(expression), not(nullValue()));
}
 
Example #13
Source File: HttpSteps.java    From pandaria with MIT License 4 votes vote down vote up
@Given("^attachment: ([^\"]*)")
public void attachment(String file) {
    context.attachment(configuration.classpathFile(file));
}
 
Example #14
Source File: HttpSteps.java    From pandaria with MIT License 4 votes vote down vote up
@Given("^header: '([^\"]*)'=\"([^\"]*)\"$")
public void headerFromString(String key, String value) {
    context.requestHeader(key, expressions.evaluate(value));
}
 
Example #15
Source File: HttpSteps.java    From pandaria with MIT License 4 votes vote down vote up
@Given("^header: '([^\"]*)'='([^\"]*)'$")
public void headerFromLiteral(String key, String value) {
    context.requestHeader(key, value);
}
 
Example #16
Source File: HttpSteps.java    From pandaria with MIT License 4 votes vote down vote up
@Given("^form: ([^\"]*)$")
public void form(String url) {
    context.reset();
    context.form(URI.create(expressions.evaluate(configuration.uri(url))));
}
 
Example #17
Source File: WaitSteps.java    From pandaria with MIT License 4 votes vote down vote up
@Given("^wait: (\\d+)ms$")
public void waitMillis(int millis) throws InterruptedException {
    sleep(millis);
}
 
Example #18
Source File: HttpSteps.java    From pandaria with MIT License 4 votes vote down vote up
@Given("^query parameter: '([^\"]*)'='([^\"]*)'$")
public void queryParameterFromLiteral(String name, String value) {
    context.queryParameter(name, value);
}
 
Example #19
Source File: VariableDefinitionSteps.java    From pandaria with MIT License 4 votes vote down vote up
@Given("^var: ([^\"' ]*)=random uuid")
public void defineRandomUUIDVariable(String name) {
    variables.assign(name, UUID.randomUUID());
}
 
Example #20
Source File: CucumberTestSteps.java    From Cloud-Native-Applications-in-Java with MIT License 4 votes vote down vote up
@Given("(.*) Service is running")
public void checkServiceRunning(String serviceName) {
	ResponseEntity<String> healthResponse = restTemplate.getForEntity("/health",String.class, new HashMap<>());
	Assert.assertEquals(HttpStatus.OK, healthResponse.getStatusCode());
}
 
Example #21
Source File: VariableDefinitionSteps.java    From pandaria with MIT License 4 votes vote down vote up
@Given("^var: ([^\"' ]*)=code: ([^\"]*)$")
public void defineVariableFromCodeInLine(String key, String code) throws ScriptException {
    variables.assign(key, eval(expressions.evaluate(code)));
}
 
Example #22
Source File: VariableDefinitionSteps.java    From pandaria with MIT License 4 votes vote down vote up
@Given("^var: ([^\"' ]*)=code:$")
public void defineVariableFromCodeBlock(String key, String code) throws ScriptException {
    variables.assign(key, eval(expressions.evaluate(code)));
}
 
Example #23
Source File: VariableDefinitionSteps.java    From pandaria with MIT License 4 votes vote down vote up
@Given("^var: ([^\"' ]*)<-response body$")
public void defineVariableExtractByResponseBody(String key) {
    variables.assign(key, toBeVerified.plainText());
}
 
Example #24
Source File: VariableDefinitionSteps.java    From pandaria with MIT License 4 votes vote down vote up
@Given("^var: ([^\"' ]*)<-'([^\"]*)'$")
public void defineVariableExtractByJsonPath(String key, String path) throws IOException {
    variables.assign(key, toBeVerified.json(path));
}
 
Example #25
Source File: VariableDefinitionSteps.java    From pandaria with MIT License 4 votes vote down vote up
@Given("^var: ([^\"' ]*)=(\\d+\\.\\d+)$")
public void defineDoubleVariable(String key, String value) {
    variables.assign(key, Double.parseDouble(value));
}
 
Example #26
Source File: VariableDefinitionSteps.java    From pandaria with MIT License 4 votes vote down vote up
@Given("^var: ([^\"' ]*)=(\\d+)$")
public void defineIntegerVariable(String key, int value) {
    variables.assign(key, value);
}
 
Example #27
Source File: VariableDefinitionSteps.java    From pandaria with MIT License 4 votes vote down vote up
@Given("^var: ([^\"' ]*)=\"([^\"]*)\"$")
public void defineStringVariable(String key, String value) {
    variables.assign(key, expressions.evaluate(value));
}
 
Example #28
Source File: VariableDefinitionSteps.java    From pandaria with MIT License 4 votes vote down vote up
@Given("^var: ([^\"' ]*)='([^\"]*)'$")
public void defineLiteralStringVariable(String key, String value) {
    variables.assign(key, value);
}
 
Example #29
Source File: WaitSteps.java    From pandaria with MIT License 4 votes vote down vote up
@Given("^wait: (\\d+)ms times: (\\d+)$")
public void waitMillisUntil(int millis, int maxRetry) {
    wait.configure(millis, maxRetry);
}
 
Example #30
Source File: GraphqlSteps.java    From pandaria with MIT License 4 votes vote down vote up
@Given("^graphql:$")
public void graphql(String body) {
    graphql.reset();
    graphql.query(expressions.evaluate(body));
}