Test Reporting and Unit Testing
Discuss about the Unit Test Reporting for Function and Program.
Unit testing can be described as a level of software where the individual components/units of a specifically tested. The main reason or the purpose for performing a unit test is to check whether a software performs the way it is designed. Thus, a unit is the smallest testable part or section of any software. Unit test reporting is thus a procedure of reporting the whole testing process. This unit testing process involves multiple inputs but only a single output. Thus, in a procedural programming, a unit can be an individual procedure, function and program (Singh & Tanwar, 2016). This study is based on the researching the unit test reporting, discussion on what the unit test reports are; how and when they are used; how does the unit test reporting fit within the software development cycle; the key metrics that a unit must show and capture. The second part of the study deals with a test reporting tool called JUnit; description of the tool and how the tool is used.
Test reporting can be described as the procedures of communicating the results of a software testing. Thus, a test report is generated based on the conclusion which is prepared after the completion of each of the test activity. The test reports are made to brief down the results of testing as designated in a test report. A plan is necessary without which meaningful test report cannot be developed (Ghuman, 2014). A test report is formulated to accomplish three major objectives like:
- Defining the scope of the major objective of the testing (this step generally includes a brief overview of the test plan).
- The results of the testing are presented.
- Drawing the necessary recommendations and conclusion that are entirely based on those results.
Considering an example, if a client who is sitting in a remote location is looking for ways to understand the status and the results of the testing project, then the unit test report is the perfect way to solve the purpose. The testing itself carries no value but it has the capability to produce the potentially valuable information. The vitality of the test information is that after it is generated, the same must be generated for it to be valuable. The major communication goals include the notifying them about the number of bugs present in the software, enlightening about the time lost due to the reopens. The test metrics must be a part of a periodic analysis report and also a part of the regular status report. The other major objectives of the test summary report are to create several questions that speak about the achievement, efficiency, effectiveness of the objectives. Devise a measurable metric so as to address the question that is already framed before. The last step or the important part of the unit test report is to implement the several improvements that enhance the achievement of the objectives (Hooda & Chhillar, 2015).
Purpose of Test Reports
When the question arises regarding where the unit test report is used, then the perfect answer is to assure that the software works as per the objectives for which it is made. Finding bugs, detecting the percentage of the bugs found using a metric system like the defect detection percentage (DDP). The DDP is calculated as the ratio of bugs detected to that of the bugs present. While the DDP for the testing is a ratio of test bugs to that of the addition of production bugs and test bugs (production bugs + test bugs) (EuroSTAR Conferences, 2018). It is always important to note that the unit test reporting is done by the two testing techniques like the white box techniques and black box testing methods.
Black box testing method is a technique which is also known as the behavioural testing and this process includes the internal design, the structure of a software item is being tested and the software item is not known to the tester. The test methodology can be both be functional and non-functional. White box testing, on the other hand, is also a testing method which involves the internal design and structure. While in this case the software item is known to the tester (Nidhra & Dondeti, 2012).
The unit test reporting is the first and is the most important part of testing. When a programmer develops a code the unit tests with respect to the various scenarios. When an application is built, in the initial stage alone it is easy to find the bugs and eliminate the same. Thus, the unit testing is considered to be an important part of all the testing and when a software package progresses ahead it becomes costlier and to identify and remove any bugs. In the majority of the cases, it is the responsibility of the developer to deliver the unit tested code (Meenakshi, Naik & Reddy, 2014). The various steps involved in the unit test reporting are as follows:
- Creation of a test plan
- Creation of the test case and test data
- If the need arises then a developer can create a script and run the vital test cases.
- When a code becomes then the code must be executed
- Fixing the bugs and re-testing the codes
- Repeating the above-mentioned steps until the unit is free from bugs (Devi, 2012).
The metrics used in the study are process metrics, product metrics and project metrics.
- Process metrics- this metrics is used to enhance and improve the efficiency of the process of the software development process.
- Product metrics- this metrics deals with the quality of the software product.
- Project metrics- these metrics are used to measure the efficiency of a team project and the testing tools are used by the members of the team (Tomar & Thakare, 2013).
The various metrics that are used in the study capture and show the percentage of the test cases that are executed; the percentage of the test cases that are not executed, the percentage of the test cases that passed; percentage of the test cases that failed; percentage of the test cases that blocked; identification of the density of the bugs, bug removal efficiency (Choudhury et al., 2017).
Black Box and White Box Testing Techniques
The sample test report is a report of the test report of a website
Test case ID
Test case description
Testing the normal running of the PHP code embedded in the HTML
PHP.ini file containing the codes for retrieving the login data.
The PHP code after execution will show up the sample log in name and password in asterisk.
Error in data retrieval
The PHP codes embedded within the HTML was buggy and thus failed to retrieve the codes.
For this study, JUnit is used as a common unit test reporting tool. JUnit is an open source tool which is used for unit testing the frameworks in Java. This tool is used by the Java developers to both write and run tests on a repeatable basis. Kent Beck and Erich Gamma are the ones that developed this tool. It is based on the xUnit architecture. The name of the tool exclusively implies that it is used for the purpose of unit testing a small chunk of code. The developers that work with the technique of test-driven methodology require must at first write and then run the unit test before any code. After all the coding work is done then a developer must execute all the tests. Thus, if a new code is entered then one must run the unit tests again so as to make sure that there is no bug (Decker, Leucker & Thoma, 2013).
The various reason why a developer needs a JUnit testing:
- The developer can develop a reliable, bug-free, readable code which enhances the confidence of a developer during development.
- Unit testing in JUnit forces a coder or a developer to focus more on reading the codes than on writing.
- JUnit tool is useful for the developers that emphasize on the test-driven methodology.
- JUnit has the capability to detect bugs in the code early which renders the codes mote reliable (Mahmood et al., 2012).
JUnit framework helps in an easy and quick generation of the test data and the test cases. The Org.JUnit package contains all the vital classes and the interfaces that are required in JUnit testing and it has the following important features: fixtures, test suites, test runners, JUnit classes (Gürcan, Dikenelli & Bernon, 2014).
Fixtures can be considered as the objects that are used as a baseline for running tests.
- setUp() method, before every invocation of test this runs.
- tearDown() method, this runs after the completion of every test (Ma'ayan, 2018).
Test suites can be called as a bundle that runs a few unit test cases at the same time. In the test suites, @Suite annotation and @RunWith are used together to run the suite test.
Test runners are utilized for the execution of the test cases.
JUnit classes are the vital classes that are used in both the writing and testing of the JUnits. Some of the important classes are as follows
- Assert- this consists of the various assert methods
- TestCase- it consists of all the test cases that define the fixtures and along with it runs the multiple tests.
- TestResult- it consists of the methods of collecting the results and executing the test case (Badri & Toure, 2012).
Thus, from the above discussion, it can be concluded that unit testing can be considered the first level of testing and it is also the most vital one. It is important to note that the identifying and fixing the bugs also helps in reduces the costs associated with the software development cycle. Thus, an effective unit testing process is equally important for an effective unit testing process and helps in developing as well as increasing a software credibility and reliability. This study throws light on a unit testing tool called JUnit and it is a framework for the Java developers.
Badri, M., & Toure, F. (2012). Empirical analysis of object-oriented design metrics for predicting unit testing effort of classes. Journal of Software Engineering and Applications, 5(7), 513.
Choudhury, P. P., Dihidar, K., Khan, A. R., Verma, R., & Sarkar, P. (2017). Software measurements and metrics: Role in effective software testing. Data in Brief, 3(2017), 593-596.
Decker, N., Leucker, M., & Thoma, D. (2013). jUnit RV–adding runtime verification to jUnit. In NASA Formal Methods Symposium (pp. 459-464). Springer, Berlin, Heidelberg.
Devi, T. R. (2012). Importance of testing in software development life cycle. International Journal of Scientific & Engineering Research, 3(5), 1-5.
EuroSTAR Conferences. (2018). Defect Detection Percentage | DDP Model | EuroSTAR. Retrieved from https://conference.eurostarsoftwaretesting.com/defect-detection-percentage-handle-care/
Ghuman, S. S. (2014). Software Testing Techniques. International Journal of Computer Science and Mobile Computing, 3(10).
Gürcan, Ö., Dikenelli, O., & Bernon, C. (2014). A generic testing framework for agent-based simulation models. In Agent-Based Modeling and Simulation (pp. 231-270). Palgrave Macmillan, London.
Hooda, I., & Chhillar, R. S. (2015). Software test process, testing types and techniques. International Journal of Computer Applications, 111(13).
Ma'ayan, D. D. (2018). The quality of junit tests: an empirical study report. In Proceedings of the 1st International Workshop on Software Qualities and Their Dependencies (pp. 33-36). ACM.
Mahmood, R., Esfahani, N., Kacem, T., Mirzaei, N., Malek, S., & Stavrou, A. (2012). A whitebox approach for automated security testing of Android applications on the cloud. In Proceedings of the 7th International Workshop on Automation of Software Test (pp. 22-28). IEEE press.
Meenakshi, D., Naik, J. S., & Reddy, M. R. (2014). Software testing techniques in software development life cycle. International Journal of computer science and information Technologies (IJCSIT), 5, 3729-3731.
Nidhra, S., & Dondeti, J. (2012). Black box and white box testing techniques-a literature review. International Journal of Embedded Systems and Applications (IJESA), 2(2), 29-50.
Singh, S. K., & Tanwar, S. (2016). Analysis of Software Testing Techniques: Theory to Practical Approach. Indian Journal of Science and Technology, 9(32).
Tomar, A., & Thakare, V. M. (2013). The Survey of Metrices on Software Quality Assurance and Reuse. In National Conference on Innovative Paradigms in Engineering & Technology (NCIPET-2013).
To export a reference to this article please select a referencing stye below:
My Assignment Help. (2019). Unit Test Reporting And JUnit Testing. Retrieved from https://myassignmenthelp.com/free-samples/unit-test-reporting-function-and-program.
"Unit Test Reporting And JUnit Testing." My Assignment Help, 2019, https://myassignmenthelp.com/free-samples/unit-test-reporting-function-and-program.
My Assignment Help (2019) Unit Test Reporting And JUnit Testing [Online]. Available from: https://myassignmenthelp.com/free-samples/unit-test-reporting-function-and-program
[Accessed 04 December 2023].
My Assignment Help. 'Unit Test Reporting And JUnit Testing' (My Assignment Help, 2019) <https://myassignmenthelp.com/free-samples/unit-test-reporting-function-and-program> accessed 04 December 2023.
My Assignment Help. Unit Test Reporting And JUnit Testing [Internet]. My Assignment Help. 2019 [cited 04 December 2023]. Available from: https://myassignmenthelp.com/free-samples/unit-test-reporting-function-and-program.