With the growing requirements of web applications,web components are developed to package the implementation of commonly-used features for reuse.In some cases,the developer may want to reuse some features which cannot...With the growing requirements of web applications,web components are developed to package the implementation of commonly-used features for reuse.In some cases,the developer may want to reuse some features which cannot be customized by the component’s APIs.He/she has to extract the implementation by hand.It is labor-intensive and error-prone.Considering the widely-used test cases which can be useful to specify the software features,a test-driven approach is proposed to extract the implementation of the desired features in web components.The satisfaction of the user^requirements is transformed into the passing rate of user-specified test cases.In this way,the quality of the extraction result can be evaluated automatically.Meanwhile,a record/replay-based GUI test generation method is proposed to ensure that the extraction result has the correct GUI appearance.To extract the feature implementation,a hierarchical genetic algorithm is proposed to find the code snippet that can pass all the tests and has the approximate smallest size.We compare our method with two existing feature extraction methods.The result shows that our method can extract the correct implementation with the minimum size.A human-subject study is conducted to show the effectiveness and weaknesses of our method in helping users extract the features.展开更多
基金supported by the Key-Area Research and Development Program of Guangdong Province under Grant No.2020B010165001the National Natural Science Foundation of China under Grant No.61976061Guangdong Basic and Applied Basic Research Foundation under Grant No.2020A1515010973.
文摘With the growing requirements of web applications,web components are developed to package the implementation of commonly-used features for reuse.In some cases,the developer may want to reuse some features which cannot be customized by the component’s APIs.He/she has to extract the implementation by hand.It is labor-intensive and error-prone.Considering the widely-used test cases which can be useful to specify the software features,a test-driven approach is proposed to extract the implementation of the desired features in web components.The satisfaction of the user^requirements is transformed into the passing rate of user-specified test cases.In this way,the quality of the extraction result can be evaluated automatically.Meanwhile,a record/replay-based GUI test generation method is proposed to ensure that the extraction result has the correct GUI appearance.To extract the feature implementation,a hierarchical genetic algorithm is proposed to find the code snippet that can pass all the tests and has the approximate smallest size.We compare our method with two existing feature extraction methods.The result shows that our method can extract the correct implementation with the minimum size.A human-subject study is conducted to show the effectiveness and weaknesses of our method in helping users extract the features.