Comments (9)
Hi,
thanks. unfortunately what you are requesting is not possible at the moment. although I agree it would be useful to have
from evomaster.
the closest we have at moment is the use of --endpointFocus
, which forces EM to test only a single endpoint
from evomaster.
okay. Thank you.
from evomaster.
Hi
Currently I am tring the endpoint focus by passing the endpoint string, I tried multiple ways, like:
- By just passing the resource url without baseurl to the paramater
- By passing endpoint
- Fix resource like Pet etc.
but I am not getting the single endpoint result. Can you guide us here from the above url. If we wants results for the 'pet' and this endpoint:/pet/{petId}/uploadImage, what string should we pass?
Thank you.
from evomaster.
hi,
it should work by passing /pet/{petId}/uploadImage
. are you saying you tried that and it does not work? what error did you get?
from evomaster.
I am having the results while usig this and not getting error. But results are not endpoint focused. Means other requests are also added to it.
I am sharing the sample output for the same. As I am unable to upload file here.
Command ised: "java -jar \src\main\resources\evomaster.jar --blackBox true --bbSwaggerUrl https://petstore.swagger.io/v2/swagger.json --outputFormat JAVA_JUNIT_4 --maxTime 120s --ratePerMinute 60 --outputFolder \src\test\java\ --endpointFocus /pet/findByStatus"
'''
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.;
import java.util.Map;
import java.util.List;
import static org.evomaster.client.java.controller.api.EMTestUtils.;
import org.evomaster.client.java.controller.SutHandler;
import io.restassured.RestAssured;
import static io.restassured.RestAssured.given;
import io.restassured.response.ValidatableResponse;
import static org.hamcrest.Matchers.;
import io.restassured.config.JsonConfig;
import io.restassured.path.json.config.JsonPathConfig;
import static io.restassured.config.RedirectConfig.redirectConfig;
import static org.evomaster.client.java.controller.contentMatchers.NumberMatcher.;
import static org.evomaster.client.java.controller.contentMatchers.StringMatcher.;
import static org.evomaster.client.java.controller.contentMatchers.SubStringMatcher.;
import static org.evomaster.client.java.controller.expect.ExpectationHandler.expectationHandler;
import org.evomaster.client.java.controller.expect.ExpectationHandler;
import io.restassured.path.json.JsonPath;
import java.util.Arrays;
/**
This file was automatically generated by EvoMaster on 2023-06-12T01:24:34.374-07:00[America/Los_Angeles]
The generated test suite contains 14 tests
Covered targets: 42
Used time: 0h 2m 8s
Needed budget for current results: 100%
*/
public class Test {
private static String baseUrlOfSut = "https://petstore.swagger.io";
/** [ems] - expectations master switch - is the variable that activates/deactivates expectations individual test cases
- by default, expectations are turned off. The variable needs to be set to [true] to enable expectations
/
private static boolean ems = false;
/* - sco - supported code oracle - checking that the response status code is among those supported according to the schema
/
private static boolean sco = false;
/* - rso - response structure oracle - checking that the response objects match the responses defined in the schema
*/
private static boolean rso = false;
@BeforeClass
public static void initClass() {
RestAssured.enableLoggingOfRequestAndResponseIfValidationFails();
RestAssured.useRelaxedHTTPSValidation();
RestAssured.urlEncodingEnabled = false;
RestAssured.config = RestAssured.config()
.jsonConfig(JsonConfig.jsonConfig().numberReturnType(JsonPathConfig.NumberReturnType.DOUBLE))
.redirect(redirectConfig().followRedirects(false));
}
@test(timeout = 60000)
public void test_0() throws Exception {
given().accept("*/*")
.get(baseUrlOfSut + "/v2/user/logout")
.then()
.statusCode(200)
.assertThat()
.contentType("application/json")
.body("'code'", numberMatches(200.0))
.body("'type'", containsString("unknown"))
.body("'message'", containsString("ok"));
}
@test(timeout = 60000)
public void test_1() throws Exception {
given().accept("application/json")
.get(baseUrlOfSut + "/v2/user/x")
.then()
.statusCode(404)
.assertThat()
.contentType("application/json")
.body("'code'", numberMatches(1.0))
.body("'type'", containsString("error"))
.body("'message'", containsString("User not found"));
given().accept("*/*")
.delete(baseUrlOfSut + "/v2/user/yTC1sDZfJ9Q")
.then()
.statusCode(404)
.assertThat()
.body(isEmptyOrNullString());
given().accept("*/*")
.contentType("application/json")
.body(" { " +
" \"firstName\": \"gVC\", " +
" \"password\": \"JgvoDehVjw1QMp\" " +
" } ")
.post(baseUrlOfSut + "/v2/user")
.then()
.statusCode(200)
.assertThat()
.contentType("application/json")
.body("'code'", numberMatches(200.0))
.body("'type'", containsString("unknown"))
.body("'message'", containsString("0"));
}
@test(timeout = 60000)
public void test_2() throws Exception {
ExpectationHandler expectationHandler = expectationHandler();
ValidatableResponse res_0 = given().accept("application/json")
.get(baseUrlOfSut + "/v2/store/inventory")
.then()
.statusCode(200)
.assertThat()
.contentType("application/json")
.body("'sold'", numberMatches(9.0))
.body("'string'", numberMatches(646.0))
.body("'pending'", numberMatches(4.0))
.body("'available1'", numberMatches(7.0))
.body("'available'", numberMatches(135.0))
.body("'PENDING'", numberMatches(1.0))
.body("'peric'", numberMatches(2.0))
.body("'Unavailable'", numberMatches(1.0))
.body("'AVAILABLE'", numberMatches(1.0))
.body("'nonavailable'", numberMatches(1.0))
.body("'not available'", numberMatches(1.0))
.body("'avaialble'", numberMatches(1.0))
.body("'free'", numberMatches(1.0));
expectationHandler.expect(ems);
given().accept("*/*")
.contentType("application/json")
.body(" [ " +
" { " +
" \"username\": \"Na3PlczdATENC8eR\", " +
" \"email\": \"u\", " +
" \"phone\": \"WGCgXlOXb1RIGr\", " +
" \"userStatus\": 104 " +
" }, " +
" { " +
" \"username\": \"mxOpE57\", " +
" \"lastName\": \"zyuAuvu0Mjj3iv\", " +
" \"email\": \"ScA8wz7\", " +
" \"phone\": \"o3Ed7sVamurcmv\" " +
" }, " +
" { " +
" \"id\": 929, " +
" \"username\": \"V_aeLTT6t7F50m\", " +
" \"firstName\": \"jG2NcvqtXnS7zG\", " +
" \"lastName\": \"\", " +
" \"email\": \"4\" " +
" }, " +
" { " +
" \"id\": 755, " +
" \"lastName\": \"9FZ\", " +
" \"password\": \"gxQX05iNdYKMFj\" " +
" } " +
" ] ")
.post(baseUrlOfSut + "/v2/user/createWithArray")
.then()
.statusCode(200)
.assertThat()
.contentType("application/json")
.body("'code'", numberMatches(200.0))
.body("'type'", containsString("unknown"))
.body("'message'", containsString("ok"));
given().accept("application/json")
.get(baseUrlOfSut + "/v2/store/order/848")
.then()
.statusCode(404)
.assertThat()
.contentType("application/json")
.body("'code'", numberMatches(1.0))
.body("'type'", containsString("error"))
.body("'message'", containsString("Order not found"));
}
@test(timeout = 60000)
public void test_3() throws Exception {
given().accept("*/*")
.contentType("application/json")
.body(" { " +
" \"username\": \"xIK\", " +
" \"lastName\": \"\", " +
" \"password\": \"ila\", " +
" \"phone\": \"dUyDFezZwmpVN\" " +
" } ")
.post(baseUrlOfSut + "/v2/user")
.then()
.statusCode(200)
.assertThat()
.contentType("application/json")
.body("'code'", numberMatches(200.0))
.body("'type'", containsString("unknown"))
.body("'message'", containsString("9223372036854757217"));
given().accept("application/json")
.contentType("application/json")
.body(" { " +
" \"petId\": 192, " +
" \"quantity\": 855, " +
" \"status\": \"approved\" " +
" } ")
.post(baseUrlOfSut + "/v2/store/order")
.then()
.statusCode(200)
.assertThat()
.contentType("application/json")
.body("'petId'", numberMatches(192.0))
.body("'quantity'", numberMatches(855.0))
.body("'status'", containsString("approved"))
.body("'complete'", equalTo(false));
given().accept("*/*")
.contentType("application/json")
.body(" [ " +
" { " +
" \"firstName\": \"neBTIJ\", " +
" \"phone\": \"keJM\", " +
" \"userStatus\": 335 " +
" }, " +
" { " +
" \"id\": 801, " +
" \"password\": \"FGB7\" " +
" }, " +
" { " +
" \"username\": \"xkij\", " +
" \"firstName\": \"2pcI\", " +
" \"lastName\": \"\", " +
" \"userStatus\": 214 " +
" } " +
" ] ")
.post(baseUrlOfSut + "/v2/user/createWithList")
.then()
.statusCode(200)
.assertThat()
.contentType("application/json")
.body("'code'", numberMatches(200.0))
.body("'type'", containsString("unknown"))
.body("'message'", containsString("ok"));
given().accept("application/json")
.contentType("application/json")
.body(" { " +
" \"id\": 630, " +
" \"petId\": 606, " +
" \"quantity\": 247, " +
" \"shipDate\": \"2039-03-03T02:58:37\", " +
" \"complete\": false " +
" } ")
.post(baseUrlOfSut + "/v2/store/order")
.then()
.statusCode(200)
.assertThat()
.contentType("application/json")
.body("'petId'", numberMatches(606.0))
.body("'quantity'", numberMatches(247.0))
.body("'shipDate'", containsString("2039-03-03T02:58:37.000+0000"))
.body("'complete'", equalTo(false));
}
@test(timeout = 60000)
public void test_4() throws Exception {
ExpectationHandler expectationHandler = expectationHandler();
given().accept("*/*")
.contentType("application/json")
.body(" { " +
" \"username\": \"6cwE2e\", " +
" \"email\": \"VI\", " +
" \"userStatus\": 668 " +
" } ")
.post(baseUrlOfSut + "/v2/user")
.then()
.statusCode(200)
.assertThat()
.contentType("application/json")
.body("'code'", numberMatches(200.0))
.body("'type'", containsString("unknown"))
.body("'message'", containsString("9223372036854757219"));
ValidatableResponse res_1 = given().accept("*/*")
.contentType("application/json")
.body(" { " +
" \"id\": 4515981145985018507, " +
" \"username\": \"VYPAxvT_mmRPyx\", " +
" \"lastName\": \"U3bV\", " +
" \"password\": \"LoH\", " +
" \"phone\": \"mhbwLIV2WDLEnYu\", " +
" \"userStatus\": 822 " +
" } ")
.put(baseUrlOfSut + "/v2/user/VYPAxvT_mmRPyx")
.then()
.statusCode(200)
.assertThat()
.contentType("application/json")
.body("'code'", numberMatches(200.0))
.body("'type'", containsString("unknown"))
.body("'message'", containsString("4515981145985018507"));
expectationHandler.expect(ems)
.that(sco, Arrays.asList(400, 404).contains(res_1.extract().statusCode()));
given().accept("application/json")
.get(baseUrlOfSut + "/v2/user/K")
.then()
.statusCode(404)
.assertThat()
.contentType("application/json")
.body("'code'", numberMatches(1.0))
.body("'type'", containsString("error"))
.body("'message'", containsString("User not found"));
given().accept("*/*")
.contentType("application/json")
.body(" { " +
" \"id\": 483, " +
" \"username\": \"j\", " +
" \"firstName\": \"Hgfu5iGjfaN9WwX\", " +
" \"lastName\": \"24iCI2kBh\", " +
" \"email\": \"RsSXdbVjxrcx04\", " +
" \"password\": \"Jm\", " +
" \"phone\": \"YUtCb1S3DbK2U\", " +
" \"userStatus\": 120 " +
" } ")
.post(baseUrlOfSut + "/v2/user")
.then()
.statusCode(200)
.assertThat()
.contentType("application/json")
.body("'code'", numberMatches(200.0))
.body("'type'", containsString("unknown"))
.body("'message'", containsString("483"));
}
@test(timeout = 60000)
public void test_5() throws Exception {
ExpectationHandler expectationHandler = expectationHandler();
given().accept("application/json")
.get(baseUrlOfSut + "/v2/user/login?" +
"username=6da6EgByW6J&" +
"password=k_oO29ha6LCj")
.then()
.statusCode(200)
.assertThat()
.contentType("application/json")
.body("'code'", numberMatches(200.0))
.body("'type'", containsString("unknown"));
given().accept("*/*")
.delete(baseUrlOfSut + "/v2/store/order/7320108638728061786")
.then()
.statusCode(404)
.assertThat()
.contentType("application/json")
.body("'code'", numberMatches(404.0))
.body("'type'", containsString("unknown"))
.body("'message'", containsString("Order Not Found"));
ValidatableResponse res_2 = given().accept("*/*")
.contentType("application/xml")
.post(baseUrlOfSut + "/v2/pet")
.then()
.statusCode(400)
.assertThat()
.contentType("application/json")
.body("'code'", numberMatches(400.0))
.body("'type'", containsString("unknown"))
.body("'message'", containsString("javax.xml.bind.UnmarshalException: unexpected element (uri:\"\", local:\"body\"). Expected elements are <{}Category>,<{}Pet>,<{}Tag>"));
expectationHandler.expect(ems)
.that(sco, Arrays.asList(405).contains(res_2.extract().statusCode()));
given().accept("*/*")
.contentType("application/json")
.body(" { " +
" \"username\": \"deqkDibW\", " +
" \"lastName\": \"8qgZZdBmu2aThie5\", " +
" \"email\": \"nu\", " +
" \"password\": \"eLHlRHsAwa_r\", " +
" \"userStatus\": 551 " +
" } ")
.post(baseUrlOfSut + "/v2/user")
.then()
.statusCode(200)
.assertThat()
.contentType("application/json")
.body("'code'", numberMatches(200.0))
.body("'type'", containsString("unknown"))
.body("'message'", containsString("9223372036854757215"));
ValidatableResponse res_4 = given().accept("application/json")
.contentType("application/x-www-form-urlencoded")
.body("")
.post(baseUrlOfSut + "/v2/pet/593/uploadImage")
.then()
.statusCode(415)
.assertThat()
.contentType("application/json")
.body("'code'", numberMatches(415.0))
.body("'type'", containsString("unknown"));
expectationHandler.expect(ems)
.that(sco, Arrays.asList(200).contains(res_4.extract().statusCode()));
}
@test(timeout = 60000)
public void test_6() throws Exception {
ExpectationHandler expectationHandler = expectationHandler();
given().accept("application/json")
.get(baseUrlOfSut + "/v2/pet/findByStatus?status=sold&status=pending")
.then()
.statusCode(200)
.assertThat()
.contentType("application/json")
.body("size()", equalTo(7))
.body("[0].'category'.'name'", containsString("bagworm"))
.body("[0].'name'", containsString("bagworm"))
.body("[0].'photoUrls'.size()", equalTo(1))
.body("[0].'photoUrls'", hasItems("6NV0"))
.body("[0].'tags'.size()", equalTo(1))
.body("[0].'tags'[0].'name'", containsString("bagworm"))
.body("[0].'status'", containsString("sold"))
.body("[1].'category'.'name'", containsString("Sajar"))
.body("[1].'photoUrls'.size()", equalTo(0))
.body("[1].'tags'.size()", equalTo(0))
.body("[1].'status'", containsString("sold"))
.body("[2].'category'.'name'", containsString("nulla quis pariatur"))
.body("[2].'name'", containsString("doggie"))
.body("[2].'photoUrls'.size()", equalTo(2))
.body("[2].'photoUrls'", hasItems("in deserunt esse", "ut do occaecat non"))
.body("[2].'tags'.size()", equalTo(2))
.body("[2].'tags'[0].'name'", containsString("eiusmod in exercitation mollit ullamco"))
.body("[2].'tags'[1].'name'", containsString("labore do dolor"))
.body("[2].'status'", containsString("sold"))
; // Skipping assertions on the remaining 4 elements. This limit of 3 elements can be increased in the configurations
given().accept("*/*")
.contentType("application/xml")
.put(baseUrlOfSut + "/v2/pet")
.then()
.statusCode(400)
.assertThat()
.contentType("application/json")
.body("'code'", numberMatches(400.0))
.body("'type'", containsString("unknown"))
.body("'message'", containsString("javax.xml.bind.UnmarshalException: unexpected element (uri:\"\", local:\"body\"). Expected elements are <{}Category>,<{}Pet>,<{}Tag>"));
ValidatableResponse res_2 = given().accept("application/json")
.get(baseUrlOfSut + "/v2/store/inventory")
.then()
.statusCode(200)
.assertThat()
.contentType("application/json")
.body("'sold'", numberMatches(7.0))
.body("'string'", numberMatches(639.0))
.body("'pending'", numberMatches(3.0))
.body("'available1'", numberMatches(7.0))
.body("'available'", numberMatches(135.0))
.body("'PENDING'", numberMatches(1.0))
.body("'peric'", numberMatches(2.0))
.body("'Unavailable'", numberMatches(1.0))
.body("'AVAILABLE'", numberMatches(1.0))
.body("'nonavailable'", numberMatches(1.0))
.body("'not available'", numberMatches(1.0))
.body("'avaialble'", numberMatches(1.0))
.body("'Widowed'", numberMatches(1.0))
.body("'free'", numberMatches(1.0));
expectationHandler.expect(ems);
given().accept("application/json")
.get(baseUrlOfSut + "/v2/pet/findByTags?tags=")
.then()
.statusCode(200)
.assertThat()
.contentType("application/json")
.body("size()", equalTo(0));
given().accept("application/json")
.get(baseUrlOfSut + "/v2/store/order/301")
.then()
.statusCode(404)
.assertThat()
.contentType("application/json")
.body("'code'", numberMatches(1.0))
.body("'type'", containsString("error"))
.body("'message'", containsString("Order not found"));
}
@test(timeout = 60000)
public void test_7() throws Exception {
ExpectationHandler expectationHandler = expectationHandler();
ValidatableResponse res_0 = given().accept("*/*")
.contentType("application/json")
.body(" { " +
" \"category\": { " +
" \"name\": \"gkrO4tj78ZA4EYTF\" " +
" }, " +
" \"name\": \"ONGfCgnq\", " +
" \"photoUrls\": [ " +
" \"9Yeg67u5\", " +
" \"7liNqVaNfF\", " +
" \"X2Ol4LGH\", " +
" \"TlW\", " +
" \"ybyOZg\" " +
" ] " +
" } ")
.post(baseUrlOfSut + "/v2/pet")
.then()
.statusCode(200)
.assertThat()
.contentType("application/json")
.body("'category'.'name'", containsString("gkrO4tj78ZA4EYTF"))
.body("'name'", containsString("ONGfCgnq"))
.body("'photoUrls'.size()", equalTo(5))
.body("'photoUrls'", hasItems("9Yeg67u5", "7liNqVaNfF", "X2Ol4LGH", "TlW", "ybyOZg"))
.body("'tags'.size()", equalTo(0));
expectationHandler.expect(ems)
.that(sco, Arrays.asList(405).contains(res_0.extract().statusCode()));
ValidatableResponse res_1 = given().accept("*/*")
.contentType("application/x-www-form-urlencoded")
.body("name=HJ7ToAU")
.post(baseUrlOfSut + "/v2/pet/203")
.then()
.statusCode(404)
.assertThat()
.contentType("application/json")
.body("'code'", numberMatches(404.0))
.body("'type'", containsString("unknown"))
.body("'message'", containsString("not found"));
expectationHandler.expect(ems)
.that(sco, Arrays.asList(405).contains(res_1.extract().statusCode()));
given().accept("*/*")
.contentType("application/json")
.body(" [ " +
" { " +
" \"id\": -771459267, " +
" \"username\": \"E4g\", " +
" \"lastName\": \"zrzbKheT2aU06uay\", " +
" \"email\": \"RFu5xwfL3d\", " +
" \"password\": \"5qtse\", " +
" \"phone\": \"MOLhps7\" " +
" }, " +
" { " +
" \"firstName\": \"R0RZoD\", " +
" \"lastName\": \"lMF\", " +
" \"password\": \"Et\", " +
" \"userStatus\": 563 " +
" }, " +
" { " +
" \"id\": 295, " +
" \"password\": \"KPdlD6e\", " +
" \"phone\": \"HvEoQCc5\" " +
" }, " +
" { " +
" \"id\": 39, " +
" \"username\": \"NRMrjg2IciOfD\", " +
" \"lastName\": \"OfTmEG\", " +
" \"email\": \"bjr_p_hO\", " +
" \"password\": \"5mVKA\", " +
" \"phone\": \"1k5\" " +
" } " +
" ] ")
.post(baseUrlOfSut + "/v2/user/createWithArray")
.then()
.statusCode(200)
.assertThat()
.contentType("application/json")
.body("'code'", numberMatches(200.0))
.body("'type'", containsString("unknown"))
.body("'message'", containsString("ok"));
ValidatableResponse res_3 = given().accept("*/*")
.contentType("application/json")
.body(" { " +
" \"name\": \"FhU8t1\", " +
" \"photoUrls\": [ " +
" \"Z_YAPR1i\", " +
" \"z\", " +
" \"4\", " +
" \"f3\" " +
" ], " +
" \"tags\": [], " +
" \"status\": \"sold\" " +
" } ")
.put(baseUrlOfSut + "/v2/pet")
.then()
.statusCode(200)
.assertThat()
.contentType("application/json")
.body("'name'", containsString("FhU8t1"))
.body("'photoUrls'.size()", equalTo(4))
.body("'photoUrls'", hasItems("Z_YAPR1i", "z", "4", "f3"))
.body("'tags'.size()", equalTo(0))
.body("'status'", containsString("sold"));
expectationHandler.expect(ems)
.that(sco, Arrays.asList(400, 404, 405).contains(res_3.extract().statusCode()));
}
@test(timeout = 60000)
public void test_8() throws Exception {
ExpectationHandler expectationHandler = expectationHandler();
given().accept("application/json")
.contentType("application/json")
.body(" { " +
" \"petId\": 901, " +
" \"complete\": true " +
" } ")
.post(baseUrlOfSut + "/v2/store/order")
.then()
.statusCode(200)
.assertThat()
.contentType("application/json")
.body("'petId'", numberMatches(901.0))
.body("'quantity'", numberMatches(0.0))
.body("'complete'", equalTo(true));
given().accept("*/*")
.contentType("application/json")
.body(" [] ")
.post(baseUrlOfSut + "/v2/user/createWithList")
.then()
.statusCode(200)
.assertThat()
.contentType("application/json")
.body("'code'", numberMatches(200.0))
.body("'type'", containsString("unknown"))
.body("'message'", containsString("ok"));
ValidatableResponse res_2 = given().accept("*/*")
.contentType("application/json")
.body(" {} ")
.put(baseUrlOfSut + "/v2/user/mGTeK0l")
.then()
.statusCode(200)
.assertThat()
.contentType("application/json")
.body("'code'", numberMatches(200.0))
.body("'type'", containsString("unknown"))
.body("'message'", containsString("0"));
expectationHandler.expect(ems)
.that(sco, Arrays.asList(400, 404).contains(res_2.extract().statusCode()));
ValidatableResponse res_3 = given().accept("application/json")
.get(baseUrlOfSut + "/v2/store/inventory")
.then()
.statusCode(200)
.assertThat()
.contentType("application/json")
.body("'sold'", numberMatches(7.0))
.body("'string'", numberMatches(644.0))
.body("'pending'", numberMatches(3.0))
.body("'available1'", numberMatches(7.0))
.body("'available'", numberMatches(133.0))
.body("'PENDING'", numberMatches(1.0))
.body("'peric'", numberMatches(2.0))
.body("'Unavailable'", numberMatches(1.0))
.body("'AVAILABLE'", numberMatches(1.0))
.body("'nonavailable'", numberMatches(1.0))
.body("'not available'", numberMatches(1.0))
.body("'avaialble'", numberMatches(1.0))
.body("'Widowed'", numberMatches(1.0))
.body("'free'", numberMatches(1.0));
expectationHandler.expect(ems);
given().accept("application/json")
.get(baseUrlOfSut + "/v2/pet/311")
.then()
.statusCode(404)
.assertThat()
.contentType("application/json")
.body("'code'", numberMatches(1.0))
.body("'type'", containsString("error"))
.body("'message'", containsString("Pet not found"));
given().accept("*/*")
.delete(baseUrlOfSut + "/v2/pet/-1278911200")
.then()
.statusCode(404)
.assertThat()
.body(isEmptyOrNullString());
given().accept("application/json")
.get(baseUrlOfSut + "/v2/user/H")
.then()
.statusCode(404)
.assertThat()
.contentType("application/json")
.body("'code'", numberMatches(1.0))
.body("'type'", containsString("error"))
.body("'message'", containsString("User not found"));
ValidatableResponse res_7 = given().accept("*/*")
.contentType("application/x-www-form-urlencoded")
.body("")
.post(baseUrlOfSut + "/v2/pet/517")
.then()
.statusCode(404)
.assertThat()
.contentType("application/json")
.body("'code'", numberMatches(404.0))
.body("'type'", containsString("unknown"))
.body("'message'", containsString("not found"));
expectationHandler.expect(ems)
.that(sco, Arrays.asList(405).contains(res_7.extract().statusCode()));
}
@test(timeout = 60000)
public void test_9() throws Exception {
given().accept("application/json")
.get(baseUrlOfSut + "/v2/user/y0a5lJbYd2n")
.then()
.statusCode(404)
.assertThat()
.contentType("application/json")
.body("'code'", numberMatches(1.0))
.body("'type'", containsString("error"))
.body("'message'", containsString("User not found"));
}
@test(timeout = 60000)
public void test_10() throws Exception {
given().accept("application/json")
.get(baseUrlOfSut + "/v2/store/order/990")
.then()
.statusCode(404)
.assertThat()
.contentType("application/json")
.body("'code'", numberMatches(1.0))
.body("'type'", containsString("error"))
.body("'message'", containsString("Order not found"));
}
@test(timeout = 60000)
public void test_11() throws Exception {
ExpectationHandler expectationHandler = expectationHandler();
ValidatableResponse res_0 = given().accept("*/*")
.get(baseUrlOfSut + "/:-1/v2/swagger.json")
.then()
.statusCode(404)
.assertThat()
.contentType("text/html");
expectationHandler.expect(ems)
/*
Note: No supported codes appear to be defined. https://swagger.io/docs/specification/describing-responses/.
This is somewhat unexpected, so the code below is likely to lead to a failed expectation
*/
.that(sco, Arrays.asList().contains(res_0.extract().statusCode()));
}
@test(timeout = 60000)
public void test_12() throws Exception {
ExpectationHandler expectationHandler = expectationHandler();
ValidatableResponse res_0 = given().accept("application/json")
.contentType("application/x-www-form-urlencoded")
.body("")
.post(baseUrlOfSut + "/v2/pet/183/uploadImage")
.then()
.statusCode(415)
.assertThat()
.contentType("application/json")
.body("'code'", numberMatches(415.0))
.body("'type'", containsString("unknown"));
expectationHandler.expect(ems)
.that(sco, Arrays.asList(200).contains(res_0.extract().statusCode()));
given().accept("application/json")
.get(baseUrlOfSut + "/v2/store/order/6159479201153389739")
.then()
.statusCode(404)
.assertThat()
.contentType("application/json")
.body("'code'", numberMatches(1.0))
.body("'type'", containsString("error"))
.body("'message'", containsString("Order not found"));
given().accept("application/json")
.get(baseUrlOfSut + "/v2/pet/86")
.then()
.statusCode(404)
.assertThat()
.contentType("application/json")
.body("'code'", numberMatches(1.0))
.body("'type'", containsString("error"))
.body("'message'", containsString("Pet not found"));
given().accept("application/json")
.get(baseUrlOfSut + "/v2/user/ClPyXyC")
.then()
.statusCode(404)
.assertThat()
.contentType("application/json")
.body("'code'", numberMatches(1.0))
.body("'type'", containsString("error"))
.body("'message'", containsString("User not found"));
}
@test(timeout = 60000)
public void test_13() throws Exception {
ExpectationHandler expectationHandler = expectationHandler();
ValidatableResponse res_0 = given().accept("application/json")
.contentType("application/x-www-form-urlencoded")
.body("")
.post(baseUrlOfSut + "/v2/pet/895/uploadImage")
.then()
.statusCode(415)
.assertThat()
.contentType("application/json")
.body("'code'", numberMatches(415.0))
.body("'type'", containsString("unknown"));
expectationHandler.expect(ems)
.that(sco, Arrays.asList(200).contains(res_0.extract().statusCode()));
}
}
'''
from evomaster.
hi,
unfortunately it looks like such parameter is only used in white-box testing, and not black-box (as such internal parameter was mainly introduced for debugging EM itself).
would need to enable it for black-box testing as well
from evomaster.
Sure, Thanks for update. Once done can you please add comment in this
from evomaster.
this should be fixed in the latest 2.0.0 release. furthermore, a new option --endpointPrefix
should enable to test only endpoints matching a given common prefix
from evomaster.
Related Issues (20)
- No proper info/warning when mismatch of version between Core and Driver processes HOT 4
- How to understand the statistics output file HOT 2
- Maven build failure while upgrading from JDK8 to JDK17.... HOT 1
- Max String length 16 when setting OpenAPI schema constraint maxLength to a higher value HOT 5
- EvoMaster Core in Maven Central HOT 1
- Support for systems with different database schemas HOT 8
- java.lang.IllegalStateException: LimitObjectGene has no value when trying to generate whitbox tests HOT 7
- OpenApi spec default value is ignored HOT 3
- additionalProperties: [true/false] causes crash HOT 2
- Authentication required when accessing schema HOT 1
- Missing utility scripts for replication HOT 1
- Errors while saving tests to src/em HOT 2
- Testcontainers: could not start container HOT 1
- mvn java run EMDriver error HOT 9
- failed attempt grapghql JS_JEST blackbox HOT 1
- Bug in GraphQL Blackbox mode HOT 4
- Is the installation supported for MAC. HOT 2
- WTSAlgorithm Crossover Bug HOT 1
- EvoMaster process terminated abruptly HOT 1
- Heuristics calculation problem HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from evomaster.