Cypress tests organizing (or any e2e/ui tests)
Nowadays cypress is quite a hype technology (I am saying this in Fall 2020, everyone knows how rapidly js world can change ;))
"Cypress is a next generation front end testing tool built for the modern web."
https://docs.cypress.io/guides/overview/why-cypress.html#In-a-nutshel
I had some experience with Behat and other types of tests like unit/integarational, but today I will tell you about e2e.
When I wrote Behat tests I didn't think a lot about how to structure my test cases in a maintainable way. This led me to the antipattern called "Single-Layer Architecture"[1].
Extending such tests quickly becomes a mess and tends to become an ineffective work:
- You can't focus on business logic, you always need to remember low-level details to introduce a new step definition
- Your low-level solutions are often duplicated, and you even don't notice that
- Changing testing framework means rewriting or updating all step definitions!
Fortunately there is an approach which is very easy to follow and which mitigates mentioned issues.
Continuous Integration with Circle CI v2 with Node.js and PHP examples
Second version of Circle CI configuration changed dramatically.
It introduced workflows, and they are used in pipes meaning.
Every workflow can include multiple steps.
Node.js example:
Непрерывная интеграция с использованием Travis CI и Behat
Эта заметка начинает цикл заметок о процессах разработки и деплоя приложений. Для начала покажу, как с помощью сервиса Travis CI можно относительно легко реализовать процесс проверки качества и работоспособности кода.
Практику постоянной проверки сборки на наличие дефектов называют Непрерывная интеграция (Continuous Integration).
Вопрос написания тестов в этой статье не будет рассмотрен - это тема другой статьи. Сделано предположение, что у вас уже настроен Behat, и тесты уже могут быть локально запущены с использованием Selenium.
Для начала, проверим, нет ли в коде нарушений установленного код стайла. Это позволит ознакомиться и начать использовать Travis CI. Если у вас нету тестов - настоятельно рекомендую использовать как минимум проверку стиля кода.
Обоснование важности консистентности кода и и его стиля можно найти во множестве мест, например, Стив Макконнелл “Совершенный код” часть 7 раздел 31.