Improving the user experience on your applications requires the deployment of numerous tests, which you can choose toautomate to save time.
But did you know that not all tests are created equal?
Some of them play a very specific role! This is particularly the case for unit tests. This test is above all a test created by the developers during the development phase (upstream if possible TTD) which participates in the improvement of the UX thanks to the control of small portions of targeted research.
A way to get into the details!
A unit test is a so-called "white box" test that allows you to check the correct operation of a single section of code by isolating it (module or unit). It consists of verifying that a functionality related to the coded instruction is operational, even in the case of new functionalities added by the development team.
This is actually the type of test that is closest to the source.
The unit test is a well-known basic test to be performed to verify very quickly that a feature is in a state of... working. 😅 This type of test must absolutely be done properly to not fail.
Its effectiveness in identifying targeted anomalies is well established .
Be careful not to misunderstand!
A unit test has many advantages. Here is a list of them:
The main advantage of unit testing is that you can test small segments of code during the development phase, in other words, even if the entire site or application has not yet been developed.
Unit tests are quick to set up, - for a test = count a few milliseconds of execution for simple functions! - unlike other more complex tests that require more time to develop and use more system resources.
This is the case for tests on the interface, which take longer to execute since they require a context (a browser for a webapp). It is therefore preferable to wait until the complete development is finished.
Regularly testing your applications with unit tests allows you to keep your code clean at all times, even in the event of functionality changes. This is a time saver and not just another chore!
Without unit testing, many unresolved failures would eventually come up. Dealing with them all at the same time post-development is more work than iteration.
Improving the code also means optimizing the user experience in fine.
How does this translate into reality? By removing the bugs and the anomalies that hinder the navigation of Internet users, of course!
The 3 A's rule is more a concept summarized by 3 main steps to follow when writing a unit test:
This first step is the one during which you will organize yourself to best meet your needs.
This second step is a feedback step: it provides you with the results produced by the test, which will be analyzed.
The final phase corresponds to a decision phase. It is a matter of deciding whether or not the results are satisfactory.
Following a change in your development, a unit test may report a failure. There are two possible explanations: