GeCaP: Unit Testing Case Generation from Java Source Code

Polibits ◽  
2018 ◽  
Vol 57 ◽  
pp. 67-73
Author(s):  
D. Larrosa ◽  
P. Fernandez ◽  
M. Delgado
Information ◽  
2019 ◽  
Vol 10 (2) ◽  
pp. 66
Author(s):  
Magdalena Kacmajor ◽  
John Kelleher

Open software repositories make large amounts of source code publicly available. Potentially, this source code could be used as training data to develop new, machine learning-based programming tools. For many applications, however, raw code scraped from online repositories does not constitute an adequate training dataset. Building on the recent and rapid improvements in machine translation (MT), one possibly very interesting application is code generation from natural language descriptions. One of the bottlenecks in developing these MT-inspired systems is the acquisition of parallel text-code corpora required for training code-generative models. This paper addresses the problem of automatically synthetizing parallel text-code corpora in the software testing domain. Our approach is based on the observation that self-documentation through descriptive method names is widely adopted in test automation, in particular for unit testing. Therefore, we propose synthesizing parallel corpora comprised of parsed test function names serving as code descriptions, aligned with the corresponding function bodies. We present the results of applying one of the state-of-the-art MT methods on such a generated dataset. Our experiments show that a neural MT model trained on our dataset can generate syntactically correct and semantically relevant short Java functions from quasi-natural language descriptions of functionality.


10.29007/z7pq ◽  
2018 ◽  
Author(s):  
Simon Thompson

The bar for adoption of refactoring tools is high: not only does a refactoring extract information from your source code, it also transforms it, often in a radical way.After discussing what users require from their tools, we will examine ways in which tool builders can try to increase their users' confidence in the tools. These mechanisms include visualisation, unit testing, property-based testing and verification, and are based on the Kent functional programming group's experience of building the HaRe and Wrangler refactoring systems for Haskell and Erlang.


Author(s):  
Saurabh Rawat ◽  
Anushree Sah ◽  
Ankur Dumka

Testing of software remains a fundamentally significant way to check that software behaves as required. Component-based software testing (CBST) is a crucial activity of component-based software development (CBSD) and is based on two crucial proportions: components testing by developers with the source code (e.g., system testing, integration testing, unit testing, etc.) and components testing by end users without source code (black box testing). This work proposes a black box testing technique that calculates the total number of interactions made by component-based software. This technique is helpful to identify the number of test cases for those components where availability of source code is questionable. On the basis of interaction among components, the authors draw a component-link graph and a direct-indirect-link matrix, which helps to calculate the number of interactions in component-based software.


Author(s):  
Mourad Badri ◽  
Aymen Kout ◽  
Linda Badri

This paper aims at investigating empirically the effect of aspect-oriented (AO) refactoring on the unit testability of classes in object-oriented software. The unit testability of classes has been addressed from the perspective of the unit testing effort, and particularly from the perspective of the unit test cases (TCs) construction. We investigated, in fact, different research questions: (1) the impact of AO refactoring on source code attributes (size, complexity, coupling, cohesion and inheritance), attributes that are mostly related to the unit testability of classes, (2) the impact of AO refactoring on unit test code attributes (size, assertions, invocations and data creation), attributes that are indicators of the effort involved to write the code of unit TCs, and (3) the relationships between the variations observed after AO refactoring in both source code and unit test code attributes. We used in the study different techniques: correlation analysis, statistical tests and linear regression. We performed an empirical evaluation using data collected from three well-known open source (Java) software systems (JHOTDRAW, HSQLBD and PETSTORE) that have been refactored using AO programming (AspectJ). Results suggest that: (1) overall, the effort involved in the construction of unit TCs of refactored classes has been reduced, (2) the variations of source code attributes have more impact on methods invocation between unit TCs, and finally (3) the variations of unit test code attributes are more influenced by the variation of the complexity of refactored classes compared to the other class attributes.


2020 ◽  
Vol 309 ◽  
pp. 02008
Author(s):  
Mengqing TanLi ◽  
Yan Jiang ◽  
Xiang Wang ◽  
Rushu Peng

After a useful and summarized procedure of software testing is put forward based software engineering view, this paper proposed a definition of fat-property according to software testing activity in product quality monitoring software. Based on fat-property, black-box testing approach is deeply investigated. In unit testing, equivalence partitioning should include two aspects: data inputting type and function operating type. And a key point of black-box testing is design of boundary/sub- boundary testing case for data inputting type. In integration testing, Sandwich mode should be applied to improve coverage. In validation testing, keynote function and non- keynote function may be tested respectively to accelerate speed of testing and assure coverage of function. System testing based on black-box according to actual usage of software product is very important, and it will determine the quality level of software product.


Sign in / Sign up

Export Citation Format

Share Document