Introduction
End to end testing is a type of automated testing where an application is tested for it's behavior to verify whether it confirms to the features and functionalities expected. It works in similar way to manual testing that is typically performed by a human.
ZWL makes it easier than ever to write and run e2e tests. Even if you're new to e2e testing, our documentation will help you become proficient in no time. Let's go through some context before we dive deep into the details.
#
ImportanceIf you've ever built a non trivial web app, you'd know the importance of testing whether it's automated or manual. Little changes breaks an entire functionality or even worse can restrict users from critical functionality such as order placement.
Most development teams deploy code several times a day. With lack of automated tests, quality assurance soon becomes unmanageable leaving production environment prone to surprise bugs.
Writing tests need to be a part of development cycle. If there exist a feature, there must exist a test. The good thing about e2e tests is that they don't test the implementation of an application module but the behavior of it. This gives us freedom to change the code as often as needed (continuos refactoring) and unless it makes changes to the behavior, no change will be needed in e2e test.
Most functionalities that can be tested manually, can also be written as e2e tests. Verifying infinite scroll, menu hovers, color verification and drag-drop are some examples.
#
How it works in ZWLZWL absorbs most hurdles of e2e testing and allows you to write clean looking, reliable tests. Our APIs are designed and named in ways that makes it easy for you to understand and choose the right tool for right task.
For example, following is a sample code to go to google, type a search term and check whether the first result is intended.
openUrl('https://google.com')type(findElement('Search', by.ariaLabel), 'wikipedia', keys.enter)firstResult = findElement('div[role="main"] div[data-async-context="query:wikipedia"] > :first-child', by.cssSelector)assertTrue(containsString(getElementText(firstResult), 'Wikipedia, the free encyclopedia'))
The code is clean and straight forward. There is a bit lengthy css selector for sure but that's unavoidable because this is not our site. In our own application, we'd assign data-testid
and other attributes to help with short, reliable selectors.
Now let's see the code again. It has clear view of what was intended. Go to a url, type in what is required, put an eye on the first result and match the result text with what we expect. Straight to the point. No imperative code and no wait. This straight forward approach makes it much easier to debug and refactor tests.
The next chapters will take you through best practices, guidance and code needed to successfully write tests.