Automated Software Testing in Simple Words
Haroon Ashraf
Senior Business Intelligence Analyst/Developer | MSc Computer Science | Database & BI Author
Testing is one of the best practices and/or fundamental units of software development (life cycle). No matter what you try to achieve through your code you always do some sort of testing in order to make sure your output (result) is according to the input (requirements).
Surprisingly testing is not only used to test a developed code but (in rare cases) also used to develop a test code then based on the testing you would develop the real code.
Manual Testing vs. Automated Testing
Generally speaking testing is of two main types (if we consider this time not to include the technical way of classifying testing): Manual Testing and Automated Testing. Manual Testing is done manually (by hand probably using pen and paper or calculator to verify output data) while Automated Testing is done by machine (software) itself by writing some instructions for the machine (software) to do it.
Another way of defining Automated Testing is to write a computer program (code) to test your computer program (code).
Unit Testing
Unit Testing means to test small unit of software such as to write a test method to test your written method, while method can be any function that performs some action based on requirements and produces some result based on expectations.
How Automated Testing works
Let us take an example of a small function to add any two numbers a and b and as a result we get their sum a+b so now if we enter 3 and 4 we will get 7 and if we enter 5 and 6 we will get 11.
//(pseudo code) Sum function to get two numbers from the user and return their sum
Sum(a,b) { return a+b; }
Now we need to test the result of above method/function against an expected value and this can be achieved in three steps:
(1) Arrange
Prepare your Sum Method to be Called and also write your Expected Result:
Sum(4,3)
Expected Result = 7
(2) Act
Call your Sum method to show Actual Result:
Actual Result = Call Sum(4,3) method
(3) Assert
Compare Your Actual Result with Expected Result:
Expected = Actual Result
7=7
The test will pass if Actual Result is equal to the Expected Result and fail if they are not equal.
In simple words automated testing is a process to write a code to test your code in such a way that you compare results from your code against the results what you expect from your code and automated means this testing is fully processed by the computer rather than humans.
Referece: