-
Notifications
You must be signed in to change notification settings - Fork 45
Description
Description
When UtSettings::useFuzzing has its default value true, no summaries are generated for test cases created by the symbolic engine. Summaries are correctly generated when useFuzzing settings is set to false.
To Reproduce
Make sure that $HOME/.utbot/settings.properties does not contain useFuzzing = false line (i.e., the default value is used).
Generate tests for a class (e.g., utbot-sample/src/main/java/org/utbot/examples/algorithms/BinarySearch.java).
Expected behavior
Test cases generated by the symbolic engine contain summaries (JavaDoc, @DisplayName, informative method names).
Actual behavior
Tests are sequentially numbered, no JavaDoc is provided, no @DisplayName is provided.
Visual proofs (screenshots, logs, images)
First 3 tests have been generated by the fuzzer and have informative names and @DisplayName.
All other tests have been generated by the symbolic engine and have no summaries.
@Test
@DisplayName("leftBinSearch: array = long[10], key = 0L -> return 1")
public void testLeftBinSearchReturnsOneWithNonEmptyPrimitiveArrayAndCornerCase() {
BinarySearch binarySearch = new BinarySearch();
long[] longArray = {
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L
};
int actual = binarySearch.leftBinSearch(longArray, 0L);
assertEquals(1, actual);
}
@Test
@DisplayName("leftBinSearch: array = long[10], key = Long.MAX_VALUE -> return -1")
public void testLeftBinSearchWithNonEmptyPrimitiveArrayAndCornerCase() {
BinarySearch binarySearch = new BinarySearch();
long[] longArray = {
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L
};
int actual = binarySearch.leftBinSearch(longArray, Long.MAX_VALUE);
assertEquals(-1, actual);
}
@Test
@DisplayName("leftBinSearch: array = long[0], key < 0L -> return -1")
public void testLeftBinSearchWithEmptyPrimitiveArray() {
BinarySearch binarySearch = new BinarySearch();
long[] longArray = {};
int actual = binarySearch.leftBinSearch(longArray, -1L);
assertEquals(-1, actual);
}
@Test
public void testLeftBinSearch1() {
BinarySearch binarySearch = new BinarySearch();
long[] longArray = {-255L};
int actual = binarySearch.leftBinSearch(longArray, -128L);
assertEquals(-1, actual);
}
@Test
public void testLeftBinSearch2() {
BinarySearch binarySearch = new BinarySearch();
long[] longArray = {-255L};
int actual = binarySearch.leftBinSearch(longArray, -255L);
assertEquals(1, actual);
}
@Test
public void testLeftBinSearch3() {
BinarySearch binarySearch = new BinarySearch();
long[] longArray = {-255L, -255L};
int actual = binarySearch.leftBinSearch(longArray, -255L);
assertEquals(1, actual);
}
@Test
public void testLeftBinSearch4() {
BinarySearch binarySearch = new BinarySearch();
/* This test fails because executable under testing alg.BinarySearch.leftBinSearch
produces Runtime exception java.lang.NullPointerException */
binarySearch.leftBinSearch(null, -255L);
}
@Test
public void testLeftBinSearch5() {
BinarySearch binarySearch = new BinarySearch();
long[] longArray = {-251L, -252L};
assertThrows(IllegalArgumentException.class, () -> binarySearch.leftBinSearch(longArray, -255L));
}
Environment
UtSettings::useFuzzer should be set to true to reproduce the bug.