修改单元测试

This commit is contained in:
star 2024-11-06 09:05:11 +08:00
parent e61f01764f
commit 0a5367ccfb
4 changed files with 57 additions and 32 deletions

View File

@ -31,20 +31,42 @@
</dependency>
<!-- 测试 -->
<!-- 测试所需 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>3.3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<!--去除内嵌tomcat-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.tomcat.embed/tomcat-embed-websocket -->
<!--websocket依赖包-->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-websocket</artifactId>
<version>8.5.23</version>
</dependency>
<dependency>
<groupId>javax.websocket</groupId>
<artifactId>javax.websocket-api</artifactId>
<version>1.1</version>
<scope>provided</scope>
</dependency>
<!-- 防止进入swagger页面报类型转换错误排除3.0.0中的引用手动增加1.6.2版本 -->
<dependency>

View File

@ -0,0 +1,32 @@
import com.ktg.RuoYiApplication;
import com.ktg.mes.qc.domain.InventoryTask;
import com.ktg.mes.qc.service.InventoryTaskService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = RuoYiApplication.class,webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class InventoryTaskTest {
@Autowired
private InventoryTaskService inventoryTaskService;
@Test
public void saveTest(){
//新建任务对象
InventoryTask inventoryTaskTest = new InventoryTask();
inventoryTaskTest.setWmsInventoryCode("TEST001");
inventoryTaskTest.setUomId("TEST001");
inventoryTaskTest.setName("测试计划");
inventoryTaskTest.setPlanPeriod("");
inventoryTaskTest.setStartTime("2022-01-01");
inventoryTaskTest.setFinishTime("2022-12-31");
inventoryTaskTest.setSuperiorTime("2022-01-01");
inventoryTaskTest.setBelowTime("2022-12-31");
inventoryTaskTest.setProductId("TEST001");
//新增
int i = inventoryTaskService.insertInventoryTask(inventoryTaskTest);
}
}

View File

@ -21,20 +21,6 @@
<artifactId>jasperreports</artifactId>
<version>6.18.1</version>
</dependency>
<!-- 测试 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>3.3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.sf.jasperreports</groupId>

15
pom.xml
View File

@ -122,21 +122,6 @@
<version>${commons.fileupload.version}</version>
</dependency>
<!-- 测试 -->
<!-- 测试 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>3.3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<!-- excel工具 -->
<dependency>
<groupId>org.apache.poi</groupId>