Writing test cases in frontend (Part 1)

Zaid Rehman
2 min readMay 23, 2021

--

This part is a theory part if you want to avoid it you can directly skip to the next part here. I believe a bit of theory is important because it helps to clear your indebt doubts for the topic.

What is Testing?

Testing is a process by which you determine that the given piece of software works in an expected way in pre-determined scenarios (use cases).

let's understand why we need testing?
As a developer our job doesn’t end when we deploy our code with the latest features on prod, we have to make sure that the code deployed works in an expected manner. We need to assure that there is no bug present in our code that can be encountered by the end-user and for this certainty, we need to test our code so that if we miss anything we can resolve it beforehand.

We can perform testing manually or by writing some scripts (automated testing). In this series, we are going to explore and learn automated testing but let us understand what is manual testing because the steps for testing is the same for both.

Manual Testing
When a person checks the working of all the functionalities and the UI behaviour of the software like for example getting a success message after submitting a form is called manual testing. We create a list of steps to be performed with their expected behaviours which are used by the manual tester.

Automated Testing
When we create a script to perform all the steps listed in manual testing and then comparing them with expected behaviour we call it automated tests.

Automated tests can be divided into three categories
1. Unit testing
2. End to End testing (E2E)
3. Integration testing

Unit Testing

It consists of testing isolated parts of the code, as units. These units usually take the form of methods, properties, UI element actions, reusable components etc. It is the fastest and cheapest to implement.

Integration Testing

It consists of testing the interaction between elements of your application, for example, communication between your UI and an API. It takes a shorter amount of time to set up and isn’t too expensive.

E2E Testing

end-to-end testing is the practice of testing if the execution of an application is performing as designed from start to finish. The entire application is tested in real-world scenarios, which includes testing the communication between components such as the database, network, APIs etc. and executing your code in a diversity of browsers. Basically testing everything. It takes a lot of time to set up and costs the most.

Now let us start the setup to test our application in our next part.

--

--