use of com.endava.cats.model.FuzzingData in project cats by Endava.
the class BaseBoundaryFieldFuzzerTest method givenABaseBoundaryFuzzerWithNoDefinedBoundary_whenGettingTheFuzzingStrategy_thenTheSkipStrategyIsBeingReturned.
@Test
void givenABaseBoundaryFuzzerWithNoDefinedBoundary_whenGettingTheFuzzingStrategy_thenTheSkipStrategyIsBeingReturned() {
myBaseBoundaryFuzzer = new MyBaseBoundaryWithoutBoundariesFuzzer(serviceCaller, testCaseListener, catsUtil, filesArguments);
FuzzingData data = getMockFuzzingData();
FuzzingStrategy strategy = myBaseBoundaryFuzzer.getFieldFuzzingStrategy(data, "field").get(0);
Assertions.assertThat(strategy.name()).isEqualTo(FuzzingStrategy.skip().name());
Assertions.assertThat(strategy.getData()).startsWith("No LEFT or RIGHT boundary");
}
use of com.endava.cats.model.FuzzingData in project cats by Endava.
the class BaseBoundaryFieldFuzzerTest method givenABaseBoundaryFuzzerWithDefinedBoundary_whenGettingTheFuzzingStrategy_thenTheReplaceStrategyIsBeingReturned.
@Test
void givenABaseBoundaryFuzzerWithDefinedBoundary_whenGettingTheFuzzingStrategy_thenTheReplaceStrategyIsBeingReturned() {
myBaseBoundaryFuzzer = new MyBaseBoundaryWithBoundariesFuzzer(serviceCaller, testCaseListener, catsUtil, filesArguments);
FuzzingData data = getMockFuzzingData();
FuzzingStrategy strategy = myBaseBoundaryFuzzer.getFieldFuzzingStrategy(data, "field").get(0);
Assertions.assertThat(strategy.name()).isEqualTo(FuzzingStrategy.replace().name());
}
use of com.endava.cats.model.FuzzingData in project cats by Endava.
the class BaseBoundaryFieldFuzzerTest method givenABaseBoundaryFuzzerAndAFieldWithNoSchema_whenGettingTheFuzzingStrategy_thenTheSkipStrategyIsBeingReturned.
@Test
void givenABaseBoundaryFuzzerAndAFieldWithNoSchema_whenGettingTheFuzzingStrategy_thenTheSkipStrategyIsBeingReturned() {
myBaseBoundaryFuzzer = new MyBaseBoundaryWithBoundariesAndIntegerSchemaFuzzer(serviceCaller, testCaseListener, catsUtil, filesArguments);
FuzzingData data = Mockito.mock(FuzzingData.class);
Mockito.when(data.getRequestPropertyTypes()).thenReturn(new HashMap<>());
FuzzingStrategy strategy = myBaseBoundaryFuzzer.getFieldFuzzingStrategy(data, "field").get(0);
Assertions.assertThat(strategy.name()).isEqualTo(FuzzingStrategy.skip().name());
Assertions.assertThat(strategy.getData()).startsWith("Data type not matching");
Assertions.assertThat(myBaseBoundaryFuzzer.typeOfDataSentToTheService()).startsWith("outside the boundary values");
}
use of com.endava.cats.model.FuzzingData in project cats by Endava.
the class BaseBoundaryFieldFuzzerTest method givenABaseBoundaryFuzzerWithNoDefinedBoundaryAndIntegerSchema_whenGettingTheFuzzingStrategy_thenTheSkipStrategyIsBeingReturned.
@Test
void givenABaseBoundaryFuzzerWithNoDefinedBoundaryAndIntegerSchema_whenGettingTheFuzzingStrategy_thenTheSkipStrategyIsBeingReturned() {
myBaseBoundaryFuzzer = new MyBaseBoundaryWithBoundariesAndIntegerSchemaFuzzer(serviceCaller, testCaseListener, catsUtil, filesArguments);
FuzzingData data = getMockFuzzingData();
FuzzingStrategy strategy = myBaseBoundaryFuzzer.getFieldFuzzingStrategy(data, "field").get(0);
Assertions.assertThat(strategy.name()).isEqualTo(FuzzingStrategy.skip().name());
Assertions.assertThat(strategy.getData()).startsWith("Data type not matching [IntegerSchema]");
}
use of com.endava.cats.model.FuzzingData in project cats by Endava.
the class BaseBoundaryFieldFuzzerTest method shouldSkipWhenFormatNotRecognized.
@Test
void shouldSkipWhenFormatNotRecognized() {
FuzzingData data = getMockFuzzingData();
StringSchema schema = new StringSchema();
schema.setFormat("cats");
data.getRequestPropertyTypes().put("emailAddress", schema);
myBaseBoundaryFuzzer = new MyBaseBoundaryWithBoundariesButNoBoundaryValueFuzzer(serviceCaller, testCaseListener, catsUtil, filesArguments);
FuzzingStrategy fuzzingStrategy = myBaseBoundaryFuzzer.getFieldFuzzingStrategy(data, "emailAddress").get(0);
Assertions.assertThat(fuzzingStrategy.name()).isEqualTo(FuzzingStrategy.skip().name());
Assertions.assertThat(fuzzingStrategy.getData()).startsWith("String format not supplied or not recognized!");
}
Aggregations