R
R
Roman Yakimchuk2021-05-29 13:00:17
JavaScript
Roman Yakimchuk, 2021-05-29 13:00:17

How to write tests for forms (Cucumber)?

Hi everyone

Let's say we want to validate a registration form.

Option 1:

Когда пользователь открыл форму регистрации
И        пользователь ввел "username" в поле "Логин"
И        пользователь ввел "password" в поле "Пароль"
И        пользователь нажал кнопку "Зарегистрироваться"
Тогда  пользователь видит уведомление "Вы были успешно зарегистрированы"


I'm concerned that this is a working test, but it doesn't test the functionality, ie. we might have received a notification, but the user might not actually have been created.

If you write such tests for forms with a lot of data, it is even more dangerous there, because individual fields may not be saved, but the form save itself will be successfully completed. Yes, this is a bug on the server, but functionally saving the form will not work correctly, and through such tests (as above) we will not know about it.

So option 2:
Когда пользователь открыл форму регистрации
И        пользователь ввел "username" в поле "Логин"
И        пользователь ввел "password" в поле "Пароль"
И        пользователь нажал кнопку "Зарегистрироваться"
Тогда  пользователь видит уведомление "Вы были успешно зарегистрированы" 
Когда  пользователь открыл форму авторизации
И         пользователь ввел "username" в поле "Логин"
И         пользователь ввел "password" в поле "Пароль"
Тогда   пользователь видит уведомление "Вы успешно вошли в систему"


But then it will be a test not of registration, but of registration and authorization. It would be fine, but if the form is complex, and there are a million scenarios, the number of steps will simply inflate to an incredible scale, and the same functionality will be tested 100 times (on the other hand, it’s good).

Your thoughts?
Does it make sense to go for option 2, and why?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
AlexPancho, 2021-05-31
@AlexPancho

your option 2 is in fact already a test suite - i.e. a collection of two related test cases
, and if you have an atomic test case 1 "register with data A"
and test case 2 "log in with data A",
then nothing prevents you from writing a two-point test suite
1 execute TC 1
2 execute TC 2
is that in "classic" test cases it is impossible to refer to test 2 in test 1. In software, this can and should be done, the main thing is that you understand exactly where the error occurred and what led to it

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question