I write tests with Cucumber, here’s what a feature-file looks like:

# language:ru Функционал: Фильтр на странице 'Где сейчас' Контекст: Чтобы на главной странице отображались или сотрудники или задачи или объекты "Диспетчер" должен иметь возможность фильтровать отображение Сценарий: выбор фильтра "Сотрудники" Пусть я зашёл на главную страницу сервиса Если нажимаю на кнопку "Фильтр" Тогда появлется всплывающее меню Если выбираю фильтр "Сотрудники" Тогда отображается список групп сотрудников И на карте отображёны иконки сотрудников Сценарий: сокрытие фильтра "Сотрудники" Пусть выбран фильтр "Сотрудники" Если нажимаю на кнопку "закрыть фильтр" Тогда окно фильтра "Сотрудники" скрыто 

Both of these scenarios work separately, the implementation of these steps is quite broad, and it doesn’t make much sense to probably bring it here, I will say only one thing, the launch of these scenarios together with such a marahika ends:

 java.lang.NullPointerException at ru.mts.m2m.b2b.stepDefinition.FilterDefinition.selectFilter(FilterDefinition.java:31) at ru.mts.m2m.b2b.stepDefinition.FilterDefinition.выбран_фильтр(FilterDefinition.java:71) at ✽.Пусть выбран фильтр "Сотрудники"(.\Feature\Filter.feature:23) java.lang.NullPointerException at ru.mts.m2m.b2b.stepDefinition.FilterDefinition.selectFilter(FilterDefinition.java:31) at ru.mts.m2m.b2b.stepDefinition.FilterDefinition.выбран_фильтр(FilterDefinition.java:71) at ✽.Пусть выбран фильтр "Сотрудники"(.\Feature\Filter.feature:23) 

What could be causing this? Where to look first?

  • look in FilterDefinition.java in line 31 - Mikhail Vaysman
  • Yes, I apologize for the haste of presentation, but this is the first where I looked. Unfortunately, this did not clarify the situation - SanchelliosProg
  • attach this code to the question - Mikhail Vaysman
  • Damn, while writing the code, I found why NullPointer. It turns out that the definition files under the new script are re-initialized, therefore, some class simply equaled null - SanchelliosProg
  • In principle, there should be only one when / then pair in a good scenario. And to make several such pairs is fundamentally wrong. - Mikhail Vaysman

0