Testing: Software development acceptance testing with Cypress


By writing tests, it is possible for developers to release high quality software in the long run. High test coverage also ensures that future regression tests provide meaningful results with little effort. The difficulty here comes from the added value perceived in daily work. In my projects, I have discovered that the development of new features in particular ensures a sense of personal accomplishment and promotes the development of a software product.

The tests do not initially provide any direct added value in the short term, except that they verify the logic and ensure its functionality. In the long term, the added value increases as soon as the writing of the tests is systematically integrated into your own development. In my work, Cypress has a proven track record, as it can be integrated into projects with little effort and can create tests quickly. In addition to Cypress, there are a number of other frameworks that can be used to write tests. This article should first introduce the relatively new framework for test automation. Next comes a comparison with a possible alternative, the long established Selenium test tool. The two tools each have different idiosyncrasies, which is why they are suitable for different application scenarios, which the article will elaborate on towards the end.

This contribution is part of a series of articles to which heise Developer has explicitly invited young developers – with the aim of informing their own genre, but of course also interested “old people”, about trends, developments, phenomena and current personal experiences. Articles in this series appear monthly. Are you a “young professional” yourself and want to be part of this series? Then apply with a suggestion to the editorial team: [email protected] We’re by your side with helpful advice throughout the drafting, editing, and approval process.

Cypress is a framework for end-to-end (E2E) testing in JavaScript, with which user behavior can be simulated in order to test workflows. There are four stages in the foreground: integration of the framework, subsequent writing of tests, running them, and debugging. In this article, I’ll focus on introducing acceptance testing and the first three stages of the workflow. Cypress has a meaningful syntax that makes it easier for developers to formulate and understand tests. The formalized language makes it possible to pre-formulate cypress tests. An example of this would be formulating the order in which the graphical user interface (GUI) elements of an application are used to perform a specific process (such as creating a blog post). This means that even people with less technical background can formulate the workflow and then a developer implements the specific test in Cypress.

The “Blogs” project allows you to view the tests. The app consists of a simple interface including elements that users can interact with, for example to activate a dark mode or to create a new blog entry. The app is based on Vue.js in combination with Vuetify. Vuetify is a hardware design framework for quickly building a sample app with UI elements for your own project. However, Cypress is not bound by any particular framework. In total, there should be three components in the example project – first of all, the surface itself, which can be seen in Figure 1.

The project blog interface (Fig. 1)

There is also a dialog for adding a new entry, shown in Figure 2. An entry consists of a title, material design icon, content, and tags. As soon as the entry has been added via the dialog box, the publication date also appears automatically.

Dialog box for adding a new entry (Fig. 2)

First, we will implement a test for the existing components and then develop an extension in the form of a filtering tag cloud. With tests in mind, the component can be constructed in such a way that tests are easy to create.

Source of the article

Disclaimer: This article is generated from the feed and is not edited by our team.


Leave A Reply