About software testing in my first projects I used to just code and run the program hundreds of times to see if the program was working and if it wasn’t working the way expected, then I started to see in which part the error might be, okay but this isn’t sounds bad no? you always do that, try to run the program and see if it works and if it doesn’t work then you fix it right? Well yes, but this is very time consuming, first because you are making the software without a previous plan, so that’s why in my opinion is important to start making some testing or stress tests to your code so you can prevent first errors in production that you never expected because you never try that part of the code, and next avoiding to spend a lot of time searching where the error occurs by testing each part of the functionality isolated, so if a test fails you know specific in which part or in which functionality the software is not working.
I don’t know if you have experienced when coding, that you have to stop coding and spend a lot of time typing the input over and over again and run the program to see in which part the error was, and the you make some changes and again you have to spend time making all the process and typing the input necessary over and over again until it works, that in my opinion is a waste of time and effort, because you can create a program to test that function in particular and you don’t have to type the same input, another advantage of making tests is that you think about how the program is going to be structured and which part is in charge of each function so basically is like planning and making your life easier when coding at the same time, but before talking about how I have been testing my recent projects I would like to explain some concepts.
There are a variety of testing levels, the one I was talking a lot in the previous paragraphs is knowns as Unit/component testing, this kind of testing is aim at each part of the software isolating every part to demonstrate that each component is correct in terms of functionality and the requirements ask by the client are correct.
System testing, this level is as the name says when you test all the system integrated, this to ensure that everything is working fine and prevent some errors that could happen while trying to integrate everything in the project.
So once we have seen this levels of testing now we can learn two approaches used a lot when testing, those methods are white-box testing and black-box testing. First talking about white-box, this method is named like that because this means that you see the interior (the code) of the box(the program), this is very useful at all levels of testing, it is from the unit-testing level to the integration and this kind of testing is focused more in the flow of the data through the process, how different inputs are handled and how you can refactor and improve the code to see potential bugs, this method is not focused only on the output of the function, it make sure that everything internal is working find.
On the other hand the Black-box method is focused only on the part of the functionality, this because the code within the box is hidden for the programmer, this kind of testing is used in most cases when you are using external software for example in the case of a web developer in the part of the front-end, they normally used black-box testing when they make use of the API made by the team of back-end because the don’t know the internal code of the program they are using but they can see if something is wrong comparing the expected output with the one it supposed to be.
Now talking about my experience doing test cases, when I started more serious projects I decided to be more organized with the way I code, so first I write all the elements that are necessary to make the project, the functional and non-functional parts and the requirements of the client, then I began with a prototype of the page to see if I am doing what the client wants and finally if all is correct I start making test cases before I start programming because in this way I know what I have to do before start to code and spend time thinking of what I am going to do now, so while making the tests I start making the documentation at the same time writing down the end point to access the function of my API, what is going to be the format of the response and the expected output, in this way when I start coding I know already what I have to do and I can focus more in the technical part without losing time testing manually each time I finish a function, and for that I use a tool called Jest so I only write the function I want to execute and the expected output instead of writing all the test cases by scratch making my time more efficient.
So in conclusion in my opinion testing is a very important step in the development of new software not only in the part of preventing bugs but also in the part of planning how the program is going to work and there are many tools you can use for start creating test cases for your next projects, another tools I have used for the part of back-end development are post-man, that thanks to this program I can access a end-point of my API and see the output without the use of a web browser and HTML to make a different types of request (POST, PUT, DELETE, GET) so a recommendation is to search a framework or tool that can make your life easier to create your testing cases, because the important part of test cases are to help you to make better software but not waste too much time creating test cases from scratch.