-
Notifications
You must be signed in to change notification settings - Fork 96
Description
In white-box mode, EvoMaster seems unable to insert data into MySQL, thus failing to cover the code logic behind the if branch. Below log can be seen in the SUT:
2025-06-23 19:54:34 [qtp1652149987-14] INFO ks.long5.KSEmbeddedSutController - Tomcat started successfully on port 8080
2025-06-23 19:54:34 [qtp1652149987-14] INFO ks.long5.KSEmbeddedSutController - Configuring database connection...
WARN - Failed to handle regex in Matcher.find(): [&\s](?[\w.-\s%])(?:=(?[^&]*))?
2025-06-23 19:54:36 [qtp1652149987-14] INFO ks.long5.KSEmbeddedSutController - Database connection configured successfully
Not analyzing JPA using javax package
Failed to load Jakarta Persistence Layer classes
2025-06-23 19:56:56 [qtp1652149987-14] INFO ks.long5.KSEmbeddedSutController - Resetting state of SUT...
-
part of the source code
CreditApply creditApply = creditApplyService.getByCreditNo(request.getNo());
if (creditApply == null) {
return CommonResp.fail(CommonCodeEnum.INVALID_PARAM, "DATA NOT EXIST");
} -
Is there any debug parameter when executing from the command line to get more information about DB operation? I tried running it for an hour, but it didn't seem to help.
java -jar /Users/apple/gitrepo/EvoMaster/core/target/evomaster.jar --maxTime 300s --outputFolder "/Users/apple/gitrepo/EvoMaster/whitebox-deom/src/main/java/ks/long9"
| | | / | | |
| |_ _____ | . . | __ _ | | ___ _ __
| __\ \ / / _ | |/| |/ ` / | / _ \ '|
| |\ V / () | | | | (| __ \ || / |
_/ _/ _/_| |/_,|/____|_|
- EvoMaster version: 3.4.1-SNAPSHOT
- Loading configuration file from: /Users/apple/em.yaml
- Initializing...
- There is only 1 usable RESTful API endpoint defined in the schema configuration
- Starting to generate test cases
- Consumed search budget: 99.869%
- Covered targets: 323; time per test: 15.4ms (1.0 actions); since last improvement: 293s
- Starting to apply minimization phase
- Recomputing full coverage for 4 tests
- Analyzing 1 tests with size greater than 1
- Minimization progress: 1/1
- Minimization phase took 0 seconds
- Evaluated tests: 8753
- Evaluated actions: 9268
- Needed budget: 1%
- Passed time (seconds): 300
- Execution time per test (ms): Avg=28.40 , min=6.00 , max=23923.00
- Execution time per action (ms): Avg=26.54 , min=6.00 , max=23923.00
- Computation overhead between tests (ms): Avg=5.72 , min=1.00 , max=665.00
- Computation overhead of resetting the SUT (ms): Avg=6.12 , min=0.00 , max=23864.00
- Computation overhead of fetching test results, per test, subset of targets (ms): Avg=1.13 , min=0.00 , max=40.00
- Starting to apply security testing
- Going to save 3 tests to /Users/apple/gitrepo/EvoMaster/whitebox-deom/src/main/java/ks/long9
- Potential faults: 2
- Covered targets (lines, branches, faults, etc.): 357
- Bytecode line coverage: 5% (147 out of 2744 in 102 units/classes)
- Successfully executed (HTTP code 2xx) 1 endpoints out of 1 (100%)
- EvoMaster process has completed successfully
-
the driver class
@OverRide
public List getDbSpecifications() {
return dbSpecification;
}private void configureDatabaseConnection() {
try {
logger.info("Configuring database connection...");Class.forName("com.mysql.cj.jdbc.Driver"); sqlConnection = DriverManager.getConnection( "jdbc:mysql://mysql.svc.cluster.local:3306/test?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&autoReconnect=true&useSSL=false&nullCatalogMeansCurrent=true", "user", "pwd" ); sqlConnection.setSchema("test"); dbSpecification = Arrays.asList(new DbSpecification(DatabaseType.MYSQL, sqlConnection)); } catch (ClassNotFoundException | SQLException e) { logger.error("Error while configuring database connection", e); }
}
@OverRide
public String startSut() {
try {
logger.info("Starting SUT...");tomcat = new Tomcat(); tomcat.setPort(8080); tomcat.getConnector(); Context context = tomcat.addWebapp("/", "/Users/apple/gitrepo/test.war"); tomcat.start(); logger.info("Tomcat started successfully on port 8080"); configureDatabaseConnection(); logger.info("Database connection configured successfully"); return "http://localhost:" + getSutPort(); } catch (Exception e) { logger.error("Failed to start SUT", e); return "Failed to start Spring MVC application."; }
}
Other important info:
version of EvoMaster (EM) used : latest code
how EM is run (eg, if from JAR or from one of its OS installers) : white-box
version of applicable runtimes (eg, JVM, NodeJS and .Net). For Java, can paste the output of java --version : 1.8.0
command-line options used to run EM