Unit Testing
Automatically imports the required configurations for MyBatis-Plus testing, quickly configuring test classes through the @MybatisPlusTest
annotation.
Example Project
mybatis-plus-boot-starter-test Source code related to MyBatis-Plus rapid testing features
Usage Tutorial
-
Add test dependency
-
Write test case
import org.junit.jupiter.api.Test;import org.springframework.beans.factory.annotation.Autowired;import static org.assertj.core.api.Assertions.assertThat;@MybatisPlusTestclass MybatisPlusSampleTest {@Autowiredprivate SampleMapper sampleMapper;@Testvoid testInsert() {Sample sample = new Sample();sampleMapper.insert(sample);assertThat(sample.getId()).isNotNull();}}