I have more than two similar REST ASSURED rests e.g.
@Test
public void makeSureThatGoogleIsUp() {
given().auth().oauth2(getToken()).contentType("application/json")
.when()
.get("http://www.google.com")
.then()
.statusCode(200);
}
@Test
public void makeSureThatGoogleIsUp() {
given().auth().oauth2(getToken()).contentType("application/json")
.when()
.get("https://stackoverflow.com")
.then()
.statusCode(200);
}
And I would've like to create method called given()
to make method less complex and readable.
private [something] given(){
return given().auth().oauth2(getToken()).contentType("application/json")
}
making my methods use my given instead of rest assured one:
@Test
public void makeSureThatGoogleIsUp() {
given()
.when()
.get("http://www.google.com")
.then()
.statusCode(200);
}
@Test
public void makeSureThatGoogleIsUp() {
given()
.when()
.get("https://stackoverflow.com")
.then()
.statusCode(200);
}
something like here: but I dont really know what kind of return type this method could have or if its even possible. Sorry, question can be trival, but seriously I'm stuck here. Any helps? Thanks! :)
Aucun commentaire:
Enregistrer un commentaire