"The tests are not optional." This seems to many a truism, remains one of the pending issues in the world of software applications development today. Yes, incredibly there are still many "metal" colleagues who are not aware that programming without tests is not only like doing trapeze acrobatics without a safety net, but also a source of errors, bad practices and anxiety.
WHY DO TESTS?
Testing is the way to make sure that what we want our program to do, do it, and do it without mistakes. Software without tests is a bomb about to explode.
Having overcome, decades ago, the human capacity for apprehension and memorization; which necessarily implies that failures and errors are inevitable if we try to avoid them with only our human capabilities.
There are several topics which the students keep on finding, one of the most prominent is application software, its objectives, and features.
Who has not passed that he has left his code half a year in a drawer, and after returning to touch him have the feeling that someone else has written it? We do not recognize our creature. And let's not talk when we are integrated into a team, or receive the " gift " of supporting or evolving an inherited code.
For this reason, the tests are essential, since they allow us to guarantee that the applications fulfil the functionalities that are expected of them and the expectations of quality (not only of code). It helps to find those errors or defects that have not yet been discovered; reducing the cost of development, the cost of ownership for users; and develop customer confidence by avoiding annoying regression errors. Not to mention the feeling of incremental security that is obtained the closer we are to deployment, because the more code we have, the more proofs assure us (in the form of a tight mesh) that everything works correctly.
DEVOPS AND THE INHERITANCE OF AUTOMATION
- DevOps- The arrival of Agile methodologies, since the 90s of the last century, was a revulsive in the organization and execution of tests within Waterfall processes.
- Inheritance of automation- In the latter, it could be generalized, the tests were mainly manual; meticulously defined in voluminous test plan documents; and that they were done only once the coding of the software was finished.
Xtreme Programming, on the other hand, put a lot of emphasis on automation and on the concept of tests oriented towards the prevention of the end of the 80s; marking in this way, the future Agile philosophy. For this reason, we currently use test frameworks that allow you to automatically perform most of the tests in all areas of the application.
MANUAL AND AUTOMATED TESTS ARE COMPLIMENTARY
And more when it is intended to adopt the concept of Continuous Integration, as an essential part of DevOps, where the construction and validation of Build itself through all kinds of automatic tests is an inherent part of the process. This being even more critical at high levels of maturity where we would apply automated deployment or, even, continuous.
The importance that the tests have gained has been such that the very way of coding the software has also undergone profound changes. The birth of TDD (test-oriented development) and its way of subjecting the code to the tests, implies that making software testable is an essential requirement in the quality code. And, even if we do not use this advanced development technique (which is not easy), the goal of being able to test our code automatically has reinforced such important practices in object-oriented programming as SOLID.
AUTOMATED TESTS VS MANUALS
- Automatic testing of the software-
Tortoise and Hare We have a first big division in the world of testing between automated and manual. As the name implies, the former depends on a testing tool that implies, in almost all cases, a language or subset of the language itself. That is, if I do them in n Unit it will be very difficult to pass them to MS Test.
- Manual Testing-
Manual testing requires human interaction. The tester puts himself in the role of a user role that has to be validated, and performs all those operations that have defined in a test plan, or seeks "tickling" the system to get there was no "user" had arrived previously...
As you can see, both types of tests are complementary and important to guarantee quality software.
Automation is fast, and you can test many subtle variations in the data. You can also easily repeat the tests as the software evolves. Because it is executed by the system, fatigue and errors that sometimes accompany repetitive tasks are avoided. In contrast, although manual tests generally take longer to execute (since a person performs them), they often require much less configuration time. It is a good option for tests that only need to be occasionally run, or in cases where the cost/time of the automation configuration exceeds the benefits.
A UNIVERSE OF TYPES OF EVIDENCE
Following are the steps of the inherent complexity of our industry, the tests also suffer from an endless myriad of types, versions, evolutions and classes. But let's focus on the most important and essential, according to each case and context.
- Unit test: Unit tests are automated tests that verify the functionality of the component, class, method or level of ownership. The main objective of the unit tests is to take the smallest piece of verifiable software in the application, isolate it from the rest of the code and determine if it behaves exactly as we expect. Each unit is tested separately before integrating them into the components to test the interfaces between the units. Unit tests must be written before (or very shortly after) writing a method; being the developers who create the class or the method, who design the test.
Thus, we managed to keep the focus on what the code should do, and it becomes a powerful tool to apply KISS, JIT, and keep the focus on what you have to do instead of how, avoiding introducing complexity without value.
- Integration tests: The individual units are integrated together to form larger components from a test perspective. In its simplest form, two units that have already been tested are combined into an integrated component, and the interface between them is tested. Integration tests - or components - identify problems that occur when units are combined. The new errors that arise are probably related to the interface between the units instead of within the units themselves; simplifying the task of finding and correcting defects.
- Regression tests: Whenever changes are made to a project, the existing code may no longer work correctly, or there may be errors not previously discovered. This type of error is called regression. To detect these defects, the entire project must undergo a regression: a new full test of a modified program, instead of a test of only the modified units, to ensure that no errors have been introduced with the modifications. As it can be deduced, this type of tests must be automated because it can be made up of tens of thousands of unit tests, or integration or more. A less expensive version could be to build tests that replicate the actions that caused the regression, and verify that they have been corrected by not happening the errors again; in addition to adding the unit tests that ensure that the code that has corrected the regression works correctly.
- Functionality tests: Automated or manual tests that test the functionalities of the application or module built from the end user, with their different roles, to validate that the software does what it should and, above all, what has been done In its automatic version are tests that are automated to "save test time". From the test cases of the manual tests, the test cases are automated so that they are repeated in the executions. These cases are usually the most important (happy flow) of the modules or business processes "vital" of the application. That is to say, the processes that always have to work and that under no circumstances can fail. The objective of automatic functional tests is to check that there are no regressions.