Running E2E Tests

Congratulations! You are just one step away from becoming a full stack application developer! For now, we will stop talking about Aurelia; you know the framework and have a high level of knowledge of how JavaScript works as a programming language. Now, it's time to expand our knowledge about full-stack application development. We have our FIFA WC 2018 application running on our localhost and have some unit testing implemented. Is it enough to ensure that it will work in a QA or production environment? Of course, no.

Unit testing is very important, but it only ensures the correct functionality of one single service. How can we ensure that all our applications (database, backend, frontend, and any other external services) are working correctly as one single application? This is what we will learn in this chapter.

Testing is one of the highly demanded skills for all developers nowadays. Why? It's because programming is no longer just writing code and to ensure that it works on your own PC, you need to create code that ensures this functionality and also be able to automate the testing process to create a continuous delivery pipeline.

We can divide the testing phase into four different levels, and we will cover each one through this chapter. Look at the following image:

We can refer to these layers as basic tests. Once we have covered all three layers, we can commit and push our code. Is that all? No. We have more advanced testing layers that should be performed using tools completely external to our application:

  • System testing ensures that all our business use cases are resolved and satisfied. It's like black box testing where we don't know how each method or operation is performed; we just care about the input and output. This kind of testing starts in the frontend layer, emulating common user operations and expecting some data already processed through the backend APIs and external services. You must know that system testing can be automated in your CI cycle.
  • Acceptance testing is performed by real end users. They ensure that your system will support all user interactions, evaluating time, performance, and one very important aspect—your app's user experience. Commonly, this test is performed by the product owner first in an external environment called user acceptance testing (UAT).

So, we can resume the testing phase in the following illustration:

We will cover each testing phase through this chapter. We've already reviewed the unit testing in the last section of Chapter 4, Creating Components and Templates, which is useful to ensure the functionality of a single component, but how can we evaluate the complete interaction between our components and other external services? It's time to go one step ahead and learn about integration testing. But even one step ahead is not enough for us, so let's go deeper and evaluate one very important but often ignored aspect of every web application: we can ensure our application functionality, but is it simple to use by our final users? UI testing will give us the answer. Finally, let's add some cool documentation to each endpoint we are exposing to be consumed by some client, even if it's web or mobile. We will show you how Swagger works and how it can generate a nice readable documentation about your API. The topics covered in this chapter are these:

  • Integration testing
  • UI testing
  • API testing â€“ Swagger

Do not pass through this chapter; testing is a very important part of the application development life cycle. Ready? Go!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset