Test Smell Detector

Fork me on GitHub

Tool Usage

Download

Download the latest release from here.

Input

Prior to executing the tool, an CSV file needs to be created. The CSV file specifies the list of test files (and their associated production file). This file will be used as input to the tool. The format of the file should be:

                    appName,pathToTestFile,pathToProductionFile
                

Example:

                    myCoolApp,F:\Apps\myCoolApp\code\test\GraphTest.java,F:\Apps\myCoolApp\code\src\Graph.java
                    myCoolApp,F:\Apps\myCoolApp\code\test\EmployeeTest.java,F:\Apps\myCoolApp\code\src\Employee.java
                    myCoolApp,F:\Apps\myCoolApp\code\test\EmployeeRelationship.java
                
Note: In the event a production file is not associated with a test file, then detection for test smells that require production files are not run.

Execution

Once the CSV file has been created, the path to the CSV file need to be passed as an argument when executing the jar.

                    java -jar .\TestSmellDetector.jar pathToInputFile.csv
                

Example:

                    java -jar .\TestSmellDetector.jar "F:\Projects\TestSmellDetector\inputFile.csv"
                

Output

The tool outputs a CSV file containing the results of the execution. The output CSV file will be created in the same location as the jar. The CSV file contains the path of the test files (and their associated production file) along with the detection status for each smell. A detection of status of 'true' indicates that the associated smell exists in the test file.

Tool Correctness

tsDetect is able to correctly detect test smells with a precision score ranging from 85% to 100% and a recall score from 90% to 100% with an average F-score of 96.5%. Click to read more

Architecture & Design

Details about the architecture of tsDetect along with information about test file and production file identification are available here.

UML class diagrams of the tool are available here, here and here

Citation

If you are using our tool in your research, please cite the following papers:



                    @inproceedings{Peruma:FSE:2020:tsDetect,
                        author = {Peruma, Anthony and Almalki, Khalid and Newman, Christian D. and Mkaouer, Mohamed Wiem and Ouni, Ali and Palomba, Fabio},
                        title = {TsDetect: An Open Source Test Smells Detection Tool},
                        year = {2020},
                        isbn = {9781450370431},
                        publisher = {Association for Computing Machinery},
                        address = {New York, NY, USA},
                        url = {https://doi.org/10.1145/3368089.3417921},
                        doi = {10.1145/3368089.3417921},                        
                        booktitle = {Proceedings of the 28th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering},
                        pages = {1650–1654},
                        numpages = {5},
                        keywords = {Detection Tool, Test Smells, Software Quality},
                        location = {Virtual Event, USA},
                        series = {ESEC/FSE 2020}
                    }
                



                    @inproceedings{Peruma:CASCON:2019:TestSmells,
                        author = {Peruma, Anthony and Almalki, Khalid and Newman, Christian D. and Mkaouer, Mohamed Wiem and Ouni, Ali and Palomba, Fabio},
                        title = {On the Distribution of Test Smells in Open Source Android Applications: An Exploratory Study},
                        year = {2019},
                        publisher = {IBM Corp.},
                        address = {USA},
                        booktitle = {Proceedings of the 29th Annual International Conference on Computer Science and Software Engineering},
                        pages = {193–202},
                        numpages = {10},
                        keywords = {unit test, test smells, software quality, software maintenance},
                        location = {Toronto, Ontario, Canada},
                        series = {CASCON '19}                        
                    }
                

Demo

Supplementary Tools

Detect unit test files in the project structure
Detect production files associated with a unit test file