Strategy for Optimizing Class Integration Test Orders: Focusing on Class Importance
收藏资源简介:
# CITO — Class Integration Test Order CITO is a research-oriented tool for computing the optimal **Class Integration Test Order** for Java projects. It extracts class-level dependency graphs through static analysis, then applies graph algorithms to determine a test order that minimizes the complexity of test stubs/mocks. ## Tech Stack - **Java 8**- **Spring Boot 2.2.6** — Web framework- **Maven** — Build tool- **Thymeleaf** — Template engine- **Apache POI 3.17** — Excel parsing- **dom4j 1.6.1** — XML parsing- **fastjson 1.2.56** — JSON serialization- **Jython 2.7.0** — Python interpreter for Java ## Quick Start ### Prerequisites - JDK 8- Maven 3.x ### Build & Run ```bash# Compile./mvnw compile # Package./mvnw package # Run tests./mvnw test # Start the web application (default port: 8080)./mvnw spring-boot:runCore Features1. Static Dependency AnalysisTwo analysis modes are available, automatically selected based on the project name: Mode Applicable Projects DescriptionSoot Analysis Default mode Performs static analysis on Java bytecode using Soot, automatically extracting attribute dependencies, method dependencies, inheritance relationships, and interface implementations between classesCSV Parsing ANT, ATM, DNS, SPM Reads pre-parsed dependency data from Excel and XML filesSoot analysis automatically filters out JDK classes and common third-party library classes, retaining only the application's own classes for analysis. 2. Class Importance EvaluationAn improved HITS algorithm (ClassHITS) is employed to evaluate the importance of each class in the dependency network, comprehensively considering: In-degree/Out-degree (Authority/Hub) K-core decomposition Structural holes Entropy weight method to balance Number of Features (NOF) and coupling 3. Integration Test Order GenerationCycle Breaking: Uses the Kosaraju algorithm to identify Strongly Connected Components (SCCs), enumerates all cycles, and removes edges based on priority: edge weight → coupling → class importance, transforming the dependency graph into a Directed Acyclic Graph (DAG) Topological Sorting: Sorts classes in descending order of importance to generate the final test order Dependency Relationship TypesThe system recognizes 5 types of dependency relationships: Type Constant DescriptionNone NONE (0) No dependencyAssociation IAS (1) Attribute references, method parameters/return values, method callsAggregation IAG (2) Multiple attribute references to the same class, upgraded to aggregationInheritance II (3) Inheritance or interface implementationDynamic Dependency Dy (4) Transitive dependency based on inheritanceProject Structuretextcito-master/├── src/main/java/com/zzc/│ ├── CitoProjectApplication.java # Spring Boot entry point│ └── CITO/│ ├── analyzer/ # Static analysis module│ │ ├── Analyzer.java # Soot bytecode analysis (default mode)│ │ ├── Parser.java # CSV/XML data parsing mode│ │ └── SootOption.java # Soot configuration│ ├── Base/ # Core data models│ │ ├── TClass.java # Graph node: class│ │ ├── TEdge.java # Graph edge: dependency│ │ ├── rType.java # Relationship type constants│ │ ├── C.java # Frontend DTO: class│ │ └── E.java # Frontend DTO: edge│ ├── BCN/ # Graph algorithms & test order generation│ │ ├── BCN.java # Main controller│ │ ├── ORD.java # Cycle breaking algorithm│ │ ├── Kosaraju.java # Kosaraju SCC + cycle enumeration│ │ ├── TestOrderBuilder.java # Topological sort for test order│ │ ├── ClassHITS.java # Improved HITS importance evaluation│ │ ├── newCLassHITS.java # Updated HITS algorithm│ │ └── getShang.java # Entropy value calculation helper│ ├── Qlearning/ # Reinforcement learning module (experimental)│ │ ├── Qlearning.java│ │ ├── NewEnvironment.java│ │ ├── Environment.java│ │ ├── CITOAgent.java│ │ └── OldQlearning.java│ ├── SCplx/ # Coupling calculation│ │ ├── SCplx.java # Structural coupling│ │ └── NewSCplx.java # Entropy weight method weighting│ ├── manager/ # Management layer│ │ ├── Manager.java # Core scheduler (main entry point)│ │ ├── InitInformation.java # Data initialization│ │ ├── SystemInfo.java # System information DTO│ │ └── ResultData.java # Result data DTO│ ├── controller/│ │ └── homeController.java # Web controller│ ├── util/ # Utility classes│ │ ├── unZip.java # ZIP extraction│ │ ├── XMLReader.java # XML dependency graph reader│ │ ├── ExcelUtil.java # Excel reader│ │ └── exportCSV.java # CSV exporter│ └── test/ # Test sample classes (A–H)├── src/main/resources/│ ├── templates/│ │ ├── display.html # File upload page│ │ └── staticAnalysis.html # Analysis results display page│ └── static/ # Static assets (Bootstrap, etc.)├── input/ # Pre-analyzed datasets├── input_analysis/ # Uploaded file extraction directory├── input_analysis_1b/ # Soot analysis input directory├── input_analysis_2/, input_analysis_2b/ # Other analysis stage data└── CSV/ # CSV output directoryWeb EndpointsEndpoint Method Description/enter GET File upload page/fileUpload POST Upload a ZIP file and auto-extract/staticPic?Name=<project_name> GET Run analysis and display results (class graph, test order)



