Получение сообщения об ошибке при выполнении сценария конечной точки GET с использованием Java и TestngJAVA

Программисты JAVA общаются здесь
Anonymous
Получение сообщения об ошибке при выполнении сценария конечной точки GET с использованием Java и Testng

Сообщение Anonymous »

Введите описание изображения здесь `i Я пытаюсь получить недавно добавленный столбец (xyz) в моем ответе при вызове GET API после создания настройки маржи категории. Ниже приведены шаги, которые я выполнил: < /p>

@before Method - Настройка теста
В методе @before я создаю настройку маржи категории, используя конечную точку после, а затем вызову API GET, чтобы получить список. Ожидаемый ответ включает в себя новый столбец xyz: `< /li>
< /ol>
{
« totalCount »: 3418,
« TotalPages »: 7,
« Данные »: [
{
field1»: 1,
"Field2": ", ABC",
". /> "Field4": "aa",
"xyz": "1"
}
]
} < /p>

Код: Выделить всё

2. Getters and Setters for 'xyz' Column I have added the following getter and setter in the model class: 

Код: Выделить всё

@JsonProperty("xyz")
public String getXyz() {
return xyz;
}

@JsonProperty("xyz")
public void setXyz(String xyz) {
this.xyz = xyz;
}
< /code>
3. Updated the Test Method with Assertion I have updated my test method to include an assertion for the xyz field:

Код: Выделить всё

  softAssert.assertEquals(setting.getXyz(), CategorySettingDAOFunctions.getXyz(), "xyz value is not equal");

Код: Выделить всё

4. Database Query Update in DAO Class In the DAO class, I have updated the method selectCategoryMarginSettingFromId to include the new column:

Код: Выделить всё

try {
conn = DatabaseUtil.getConnection();
preparedStatement = conn.prepareStatement(selectQuery);
ResultSet rs = preparedStatement.executeQuery();
while (rs.next()) {
xyz = rs.getString("xyz");
}
}
< /code>
This method is called inside the test method. The SELECT query has been updated to include XYZ:

SELECT
column_1,
column_2,
column_3,
column_4,
column_5,
column_6,
column_7,
column_8,
column_9,
column_10,
column_11,
column_12,
column_13,
column_14,
column_15,
XYZ,
column_17,
column_18,
column_19
FROM table_A
LEFT JOIN table_B ON table_A.ref_id = table_B.id
LEFT JOIN table_C ON table_C.id = table_A.other_ref_id
LEFT JOIN table_D ON table_D.id = table_C.region_id
LEFT JOIN table_E ON table_E.id = table_C.market_id
WHERE table_A.type = 1
AND table_A.status = 1
AND table_A.id = %s;
< /code>
`Issue:
I am getting the following error when executing my test:
How can I resolve this issue? Any insights would be appreciated!`

Подробнее здесь: https://stackoverflow.com/questions/795 ... java-and-t

Вернуться в «JAVA»