public interface SutHandler
| Modifier and Type | Method and Description |
|---|---|
InsertionResultsDto |
execInsertionsIntoDatabase(List<InsertionDto> insertions,
InsertionResultsDto... previous)
Execute the given data insertions into the database (if any)
|
void |
resetStateOfSUT()
Make sure the SUT is in a clean state (eg, reset data in database).
|
default void |
setupForGeneratedTest()
There might be different settings based on when the SUT is run during the
search of EvoMaster, and when it is later started in the generated tests.
|
String |
startSut()
Start a new instance of the SUT.
|
void |
stopSut()
Stop the SUT.
|
default void setupForGeneratedTest()
String startSut()
Start a new instance of the SUT.
This method must be blocking until the SUT is initialized.
How this method is implemented depends on the library/framework in which
the application is written.
For example, in Spring applications you can use something like:
SpringApplication.run()
void stopSut()
Stop the SUT.
How to implement this method depends on the library/framework in which
the application is written.
For example, in Spring applications you can save in a variable the ConfigurableApplicationContext
returned when starting the application, and then call stop() on it here.
void resetStateOfSUT()
Make sure the SUT is in a clean state (eg, reset data in database).
A possible (likely very inefficient) way to implement this would be to
call stopSUT followed by startSUT.
When dealing with databases, you can look at the utility functions from
the class DbCleaner.
How to access the database depends on the application.
To access a java.sql.Connection, in Spring applications you can use something like:
ctx.getBean(JdbcTemplate.class).getDataSource().getConnection().
InsertionResultsDto execInsertionsIntoDatabase(List<InsertionDto> insertions, InsertionResultsDto... previous)
insertions - DTOs for each insertion to executeCopyright © 2016–2021. All rights reserved.