Aspect-oriented programming (AOP) complements object-oriented programming by supporting the modularization of crosscutting concerns through aspect units, thus improving the understandability and maintainability of software and reducing the software development costs. However, there may still be some faults left inside aspect-oriented programs by programmers. Thus, it is necessary to find these faults through efficient testing techniques specific for aspect-oriented programs. Compared with object-oriented language, aspect-oriented language has new language components, and aspect-oriented software exhibits some special characteristics of behaviors, such as multi-quantitative, which have brought many challenges to aspect-oriented software testing. Towards the aspect-unit testing methods of aspect-oriented program, this thesis studies the following parts: faulty model of aspect unit, testable predicate model of pointcut, theory of detecting faults thoroughly and performing tests sufficiently, and implementation of testing tools.Fault model of aspect unit can provide goals for unit testing of aspect-oriented software. Because it is hard to prove the correctness of software behavior through testing approaches, effective test techniques are usually correlated with some faulty models therefore called as faulty-model-oriented testing. It aims to find out whether there exist some special faults inside the program, and testing process dose not stop until all possible places where fault may happen are covered by the execution of test cases. So the quality of test largely depends on the reasonability of the fault-model. This thesis classifies possible fault types in fault model of aspect-unit, and extensively studies each fault type according to three directions, that are fault characteristics, features of faults and feasibility of detecting these faults. Fault model should be the basis for construction of testable model of aspect unit.Testable predicate model of pointcut is the basis for testing pointcut of aspect unit in aspect-oriented program. The semantics of pointcuts depends on how to filter out an expected set of join points from all join points in the program, thus this thesis proposes that the testable predicate model of pointcut includes both predicate model for specification and predicate model for implementation. The predicate model-based specification of one pointcut is used to define one expected set X of join points, so the non-expected set of join points is the complement of X. The predicate model for implementation of pointcuts, which includes two standard expression styles including both sum of product and product of sum, is a predicate expression composed of function items with join point as free virable. The predicate model for pointcuts supports statically test and dynamically test of pointcut.Both necessary and sufficient conditions of finding faults, and sufficient condition of generating test cases are the bases of aspect unit testing theory. Exhaustive policy is used in testing static pointcuts which depends on necessary and sufficient conditions, and selective testing is used in testing dynamic pointcuts which depends on sufficient conditions of generation of test cases. This thesis proves both of them and also gives the proofs for some theorems to reduce unit test domain of dynamic pointcuts.This thesis suggests a novel approach to test pointcuts by classifying them into two disjoint parts: static pointcuts and dynamic pointcuts. During the process of testing static pointcuts, the specification of pointcut should be transformed into pointcut definition, and which then generates test case also as pointcut definition by combining with the pointcut implementation, after that test execution will be drived through compiler's weaving process, finally the test results will be extracted by analyzing the woven binary byte-codes. When dynamic pointcuts are tested, which has to be performed through dynamically testing the woven modules, the size of possible testing domain is too large to test join point one by one. In order to solve the problem, this thesis proposes a test technique including two phrases for testing dynamic pointcuts. In the first phrase, static part of dynamic pointcut will be tested through approaches to testing static pointcuts proposed previously, and the test domain for dynamic part of dynamic pointcut could be reduced by static methods which are proposed by the thesis based on join point flow graph of the aspect-oriented program under test. The time cost of the first phrase is small. In the second phrase, suggested coverage rules based on JPFG, such as nodes coverage, edges coverage and pathes coverage and so on, could help testers decide whether the set of generated test cases is sufficient. Experiments on many aspect-oriented applications show that our test method is applicable and effective.This thesis proposes AJUTester, which is an effective prototype framework for unit test of aspect unit of AspectJTM programs. AJUTester supports testing pointcuts and advices in aspect unit. During testing pointcuts process, testers first transforms the specification of pointcut into pointcut definitions and combinds it with the implemention of pointcut itself to generate the test cases, then AJUTester drives the generated test cases to execute and compute the reduced dynamic test domain automatically. Finally, it helps testers to optimize test cases by improving the percent coverage of test inputs based on join point flow graph, which was built from the aspect-oriented program automatically. Experiments conducting on many aspect-oriented applications confirm the applicability of AJUTester... |