Research on Unit Testing Technology Based on Java Platform

Author
YuBo
Advisor
ZhangDaFang , WangShuLin
School
Hunan University
Major
Computer Software and Theory
Classification
TP311.52 Software Development
Degree
Master's thesis
Year
2005
Downloads
226
Citations
6

Request the full text

Abstract

With Java technology is the growing popularity and widespread attention, how to improve the The Java applications credibility is an important issue that should not be ignored. The unit testing of Java applications is to ensure the quality of the software, the key to improve software reliability. Done manually unit test time-consuming and tedious, automated unit testing has become an important means save the cost of software development and improve software credibility. Therefore, this paper is to study these two issues for the degree of automation of unit testing of Java applications in the automatic generation of test data and improve unit test. This paper analyzes the relationship between the behavior of sub-types and class behavior compatibility, described the transformation to the class behavior compatibility mapping using a sub-type of behavior can get the correct class invariants, method pre-conditions and post-conditions. Accurate class invariants and method postconditions as test oracles, and class invariants and method pre-conditions as a division of equivalence classes and analysis of boundary value input. Then, two generating test data is given for the need to manually calculate the expected value of unit testing: inspecting the production and experimental frequently used statistical methods: orthogonal experimental design method and uniform design method to generate test data, the enumeration method and the uniform design method of test data generated by the uniform design supplementation improved compared to the uniform design supplementary method to generate test data in the test cost and test the effect of better value for money; proposed based on improved genetic algorithm to automatically generate Java classes The method of the test data, the method uses binary coding and floating point data using integers, characters and bytes Float encoding hybrid coding, Java class represented by the form of a byte code adding means, and randomly generates a set of test data as the initial population through test coverage analyzer to monitor the implementation process of the test program, in order to obtain coverage as a fitness value, the implementation of genetic manipulation, the experimental results show that: the improved genetic algorithm to automatically generate Java class test data. Java program abstract class contains the implicit interface the other implicit class and ordinary class test different mode of test cases, combination of the Liskov alternative test requirements of the principles of the class, and the automatic generation of test cases based on Junit template tool. Finally, based on Junit testing framework and the results of the study, a prototype of a Java platform unit testing tool. Programmers can improve the development of this tool as a platform, programmers can automatically generate test data and test case template, writing test cases, expectations need to be added to automatically generate test cases template to get a complete test case the efficiency and credibility of being tested software unit.

Table of contents

Abstract 8-9 Abstract 9-13 Chapter 1 Introduction 13-20 1.1 Background 13 <br / > 1.2 OOP unit tests outlined 13-17 1.2.1 OOP unit test 13-14 1.2.2 unit testing process 14-17 1.3 based on Java platform unit testing Research 17-18 1.3.1 Junit 17 1.3.2 Jtest 17-18 1.3 .3 JML 18 1.3.4 JAOUT 18 1.4 of job content and significance 18-19 1.5 This organizational structure 19-20 Chapter 2 test metrics 20-25 2.1 coverage analyzers 20-21 2.1.1 statement coverage and branch coverage 20-21 2.1.2 Complexity Metrics 21 2.2 coverage 21-22 2.3 Java Variation 22-25 < br /> 2.3.1 mutation testing process 22 2.3.2 variant scores 22-23 2.3.3 mutation 23 2.3 .4 inheritance and polymorphism syntactic patterns 23-25 ?? Chapter 3 Contract-based automatic generation of test data 25-38 3.1 type, subtype, and subtyping 25-26 3.1.1 Liskov substitution principle 26 3.2 class, subclass and subclass 26-30 3.2.1 seek Fine calculus 27 3.2.2 Accuracy class definitions 27-28 3.2.3 compatibility of such acts 28-29 3.2.4 a counter-example 29 3.2.5 Contract and unit testing 29-30 3.3 Test Data Generation Strategy 30-34 3.3.1 Orthogonal Experimental Design 30-31 3.3.2 Uniform Design Method 31-34 3.4 Experimental 34-37 3.4.1 runtime environment experiment 34 3.4.2 experimental subjects 34 3.4.3 Experimental Procedure 34-35 3.4.4 Experimental results and analysis 35-37 3.4.5 experimental results 37 3.5 Summary 37-38 Chapter 4 based on genetic algorithm automatically generate test data 38 - 48 4.1 Java class files and bytecode engineering library 38-41 4.1.1 Java class file 38-39 4.1.2 bytecode engineering Library 39-40 4.1.3 covering monitor 40-41 4.2 GA 41-44 4.2.1 The basic genetic algorithm principle 41 4.2.2 test data generation and genetic algorithm 41-42 4.2.3 Genetic Algorithm convergence 42-43 4.2 .4 genetic algorithm 43-44 4.3 based on genetic algorithm to generate test data tool prototype 44-46 4.3.1 Introduction prototype tool 44 4.3.2 Tool prototype algorithm description 44-46 4.4 Experimental 46-47 4.4.1 experimental environment 46 4.4.2 subjects 46 4.4.3 Experimental results 46-47 4.5 Summary 47-48 Chapter 5 unit testing tools based on Java platform prototype 48-67 5.1 Junit automatically generate test cases based on a template 48-56 5.1.1 Liskov substitution principle compatible with the type of conduct 48-49 5.1.2 inherited transitive 49 5.1.3 Junit class based on test mode 49-53 5.1.4 Java assertions, preconditions and testing God encyclical 53-54 5.1.5 Tool Design and Implementation 54-56 5.2 based on Java platform unit testing prototype tools to achieve 56-65 5.2.1 prototyping tool development thinking 56-57 5.2.2 Tools top structure and main functions of Figure 57-62 5.2.3 The program's interface demo 62-65 5.3 Summary 65-67 Conclusion 67-69 References 69-73 Thanks 73-74 Appendix A 74-75 Appendix B 75-82 Appendix C 82

Related dissertations

  1. Object-oriented software testing technique
    ZhangXuePing ·Zhengzhou University ·2001 ·Master's thesis
  2. The Logistics Center Location Planning of Tralin Group Straw Supply
    ZhouXuan ·Nanjing Agricultural College ·2013 ·Master's thesis
  3. Research on Elevator Group Control System Scheduling Policy and Simulation Design
  4. Study on MDF Continuous Press Position Servo System Modeling and Intelligent Control
    HuangXiaoZhou ·Northeast Forestry University ·2013 ·Master's thesis
  5. Study on Modeling and Optimizing of Supply Chain Multi-time Periods Integrated Plan Under Uncertain Environment
    ZhuYanBo ·Northeastern University ·2013 ·Master's thesis
  6. Research and Application on the Hybrid Colony Algorithm
  7. The Research and Application of Shuffled Frog Leaping Algorithm Based on Average Value
    SongLei ·Gansu Agricultural University ·2013 ·Master's thesis
  8. Research on Production Scheduling Problem Based on Order Disturbance
  9. Decision and Analysis of Metallurgical Products Price Based on Artificial Neural Networks
  10. Modified Shuffled Frog Leaping Algorithms and the Application of Multi-objectives Optimization
    WangZuoRan ·Gansu Agricultural University ·2013 ·Master's thesis
  11. Research on Closed-loop Logistics Network Design Based on Low Carbon Economy
    ZhangPeng ·Yanshan University ·2013 ·Master's thesis
  12. Friction Compensation and Adaptive Control for the Linear Single Inverted Pendulum
  13. Design of H2/H∞Robust Control Based on Multi-objective Genetic Algorithms
    WangZuo ·Northeastern University ·2013 ·Master's thesis
  14. T-S Fuzzy Modeling and Control for Nonlinear Network Control Systems
  15. Research on Recommender System Applied in Open Network Learning Environment
    FangFei ·Anhui University ·2014 ·Master's thesis
  16. Simulation and Optimization of Crankshaft Production Line Based on Discrete System Simulation
    ZhangMin ·Hunan University ·2013 ·Master's thesis
  17. Research on Database Schema Matching Based on Instances Clustering
    ZhangZuoXin ·Harbin Engineering University ·2013 ·Master's thesis
  18. Liaocheng Mobile Corporation material management system optimization analysis
    LiXianHui ·Shandong Normal University ·2013 ·Master's thesis
  19. Research and Implementation of Agent-based Intelligent E-commerce System
    LiuJingLing ·Northeastern University ·2013 ·Master's thesis
  20. The Design and Implementation of the Air Transport System Based on Improved Genetic Algorithm
    GaoQing ·Jilin University ·2013 ·Master's thesis