Sign inSubmit
computersciencejournal.org is not ours. This journal is published only at thescipub.com/jcs. Report a suspicious emailcomputersciencejournal.org is not ours · Report
ArticleMetrics
Research Article · Free to read · Published 31 December 2008

A Complete Automation of Unit Testing for JavaScript Programs

M. Alshraideh

Journal of Computer Science, Volume 4, Issue 12, pp. 1012–1019 · doi.org/10.3844/jcssp.2008.1012.1019

7,289 accesses5,068 downloads10 citations (Crossref)Metrics
Cite Check for updates

Abstract

Problem statement: Program testing is expensive and labor intensive, often consuming more than half of the total development costs, and yet it is frequently not done well and the results are not always satisfactory. The objective of this paper is to present an automatic test data generation tool that aims to completely automate unit testing of JavaScript functions. The methodology: In order to use the proposed tool, the tester annotates the files that contain the class to be tested. Moreover, the tester must specify the test data coverage criterion to be used, either branch coverage or mutation analysis. However, the tool is then integrated into the JavaScript compiler and test generation is invoked by a command line option. Also, the code to be tested is parsed into an abstract syntax tree from which the test tool generates a program dependency graph for the function under test. However, if mutation analysis coverage is required, the abstract syntax tree for a meta-mutant program is also generated. To provide guidance for the test data search, the function under test instrumented in accordance with the coverage criterion. Branch predicate expressions are always instrumented, in the case of mutation coverage, mutated statements are also instrumented. Compilation then continues from the modified abstract syntax tree to generate instrumented executables that were loaded into the test data search module. Results: The experiment done in our study by using the proposed tool for branch coverage shows that the most effective result for string equality was obtained using the edit distance fitness function, while no significant difference was found in the fitness function for string ordering. Through exhaustive mulation coverage 8% are found to be equivalent. Conclusion: By having a complete automation it reduces the cost of software testing dramatically and also facilitates continuous testing. It is reported that at least 50% of the total software development costs is due to testing, and 10-15% of development time is wasted due to frequent stops for regression testing. Automation will also help get rid of cognitive biases that have been found in human testers. Acknowledgment: The researcher would like to express their gratitude to the anonymous referees for their valuable and helpful comments and suggestions in improving the study.

Licence and reuse

Free to read. This article carries the publisher’s copyright, as printed on it: © 2008 Science Publications. It is free to read; ask us before reusing it.

How to reuse this article

Responses (0)

Have a comment on this research? Sign in to respond. Responses are moderated and published with your name and affiliation; the authors are invited to reply. How we use your dataWrite a response

About this article

Cite this article

Alshraideh, M. (2008). A Complete Automation of Unit Testing for JavaScript Programs. Journal of Computer Science, 4(12), 1012–1019. https://doi.org/10.3844/jcssp.2008.1012.1019

Licence
© Science Publications
Issue
Volume 4, Issue 12
Policies
Editorial independenceUse of generative AIData availabilityAppeals and complaints
Version
Version of record
A Complete Automation of Unit Testing for JavaScript ProgramsJournal of Computer Science · Volume 4, Issue 12 · pp. 1012–1019 · © Science PublicationsDownload