Skip to content

Add DataTable for some steps with fields #150

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Daleksande
Copy link

Добавил несколько шагов с групповым вводом и проверкой значений в полях с использованием DataTable.

*/
@Тогда("^(?:поля|элементы) содержат значения из таблицы")
@Then("^(?:fields|elements) contain values from the DataTable")
public void testActualValuesContainsSubstrings(DataTable arg) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'test' — это префикс юнит-тестовых методов. Зачем он здесь?

for (int i = 0; i < table.size(); i++) {
String elementName = table.get(i).get("elementName");
String value = table.get(i).get("value");
testActualValueContainsSubstring(elementName, value);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

То же самое.

@Then("^(?:fields|elements) contain values from the DataTable")
public void testActualValuesContainsSubstrings(DataTable arg) {
List<Map<String, String>> table = arg.asMaps(String.class, String.class);
for (int i = 0; i < table.size(); i++) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: неплохое место, чтобы использовать стрим.

List<Map<String, String>> table = arg.asMaps(String.class, String.class);
for (int i = 0; i < table.size(); i++) {
String elementName = table.get(i).get("inputName");
String value = table.get(i).get("value");
Copy link
Contributor

@alkekkonen alkekkonen Apr 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Так ли нужно дублировать это три строчки? Вероятно, есть смысл положить их в отдельный метод.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants