This commit is contained in:
lijinxing 2020-05-09 10:26:55 +08:00
commit a26650599b
3 changed files with 85 additions and 70 deletions

View File

@ -1,7 +1,6 @@
package com.dispose.TestSuit; package com.dispose.TestSuit;
import com.dispose.controller.AuthControllerQATest; import com.dispose.controller.AuthControllerSmokeTest;
import com.dispose.controller.TaskControllerExceptionSmokeTest;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.Suite; import org.junit.runners.Suite;
@ -10,8 +9,7 @@ import org.junit.runners.Suite;
*/ */
@RunWith(Suite.class) @RunWith(Suite.class)
@Suite.SuiteClasses({ @Suite.SuiteClasses({
AuthControllerQATest.class, AuthControllerSmokeTest.class
TaskControllerExceptionSmokeTest.class
}) })
public class SmokeTest { public class SmokeTest {

View File

@ -3,7 +3,6 @@ package com.dispose.controller;
import com.dispose.Global.InitTestEnvironment; import com.dispose.Global.InitTestEnvironment;
import com.dispose.common.ErrorCode; import com.dispose.common.ErrorCode;
import com.dispose.pojo.po.ReturnStatus; import com.dispose.pojo.po.ReturnStatus;
import com.dispose.pojo.vo.auth.LoginRsp;
import com.dispose.pojo.vo.auth.LogoutRsp; import com.dispose.pojo.vo.auth.LogoutRsp;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;

View File

@ -12,6 +12,7 @@
* accordance with the terms of the license. * accordance with the terms of the license.
*/ */
package com.dispose.controller; package com.dispose.controller;
import com.dispose.Global.InitTestEnvironment; import com.dispose.Global.InitTestEnvironment;
import com.dispose.common.ErrorCode; import com.dispose.common.ErrorCode;
import com.dispose.pojo.entity.DisposeDevice; import com.dispose.pojo.entity.DisposeDevice;
@ -35,17 +36,17 @@ import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
/** /**
* @author lsx * The type Device node info controller smoke test.
* @Desc
* @date 2020-05-08 11:19
*/ */
@AutoConfigureMockMvc @AutoConfigureMockMvc
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@ -66,14 +67,15 @@ public class DeviceNodeInfoControllerSmokeTest extends InitTestEnvironment{
private ObjectMapper objectMapper; private ObjectMapper objectMapper;
/** /**
* The Dispose device manager. * The Dispose node manager.
*/ */
@Resource @Resource
private DisposeNodeManager disposeNodeManager; private DisposeNodeManager disposeNodeManager;
/** /**
* 正常获取节点版本信息-获取存在的一个节点版本信息 * A 1 get version normal one exist device test.
* @throws Exception *
* @throws Exception the exception
*/ */
@Test @Test
public void a1_getVersionNormalOneExistDeviceTest() throws Exception { public void a1_getVersionNormalOneExistDeviceTest() throws Exception {
@ -93,7 +95,7 @@ public class DeviceNodeInfoControllerSmokeTest extends InitTestEnvironment{
String msgContent = verifyResp(ver); String msgContent = verifyResp(ver);
List<VersionRsp> verList = objectMapper.readValue(msgContent, new TypeReference<List<VersionRsp>>() { List<VersionRsp> verList = objectMapper.readValue(msgContent, new TypeReference<List<VersionRsp>>() {
}); });
Assert.assertTrue(verList.size() == 1); Assert.assertEquals(1, verList.size());
for (VersionRsp versionRsp : verList for (VersionRsp versionRsp : verList
) { ) {
if (verifyDeviceIdExists(versionRsp.getId())) { if (verifyDeviceIdExists(versionRsp.getId())) {
@ -109,8 +111,9 @@ public class DeviceNodeInfoControllerSmokeTest extends InitTestEnvironment{
} }
/** /**
* 正常获取节点版本信息-获取多个节点版本信息 * A 2 get version normal several device test.
* @throws Exception *
* @throws Exception the exception
*/ */
@Test @Test
public void a2_getVersionNormalSeveralDeviceTest() throws Exception { public void a2_getVersionNormalSeveralDeviceTest() throws Exception {
@ -146,8 +149,9 @@ public class DeviceNodeInfoControllerSmokeTest extends InitTestEnvironment{
} }
/** /**
* 正常获取节点版本信息-获取不存在的一个节点版本信息 * A 3 get version normal one not exist device test.
* @throws Exception *
* @throws Exception the exception
*/ */
@Test @Test
public void a3_getVersionNormalOneNotExistDeviceTest() throws Exception { public void a3_getVersionNormalOneNotExistDeviceTest() throws Exception {
@ -174,8 +178,9 @@ public class DeviceNodeInfoControllerSmokeTest extends InitTestEnvironment{
} }
/** /**
* 获取节点版本信息-msgContent为空 * A 4 get version msg empty exception test.
* @throws Exception *
* @throws Exception the exception
*/ */
@Test @Test
public void a4_getVersionMsgEmptyExceptionTest() throws Exception{ public void a4_getVersionMsgEmptyExceptionTest() throws Exception{
@ -200,8 +205,9 @@ public class DeviceNodeInfoControllerSmokeTest extends InitTestEnvironment{
} }
/** /**
* 获取节点版本信息-msgContent为null * A 5 get version msg null exception test.
* @throws Exception *
* @throws Exception the exception
*/ */
@Test @Test
public void a5_getVersionMsgNullExceptionTest() throws Exception { public void a5_getVersionMsgNullExceptionTest() throws Exception {
@ -226,8 +232,9 @@ public class DeviceNodeInfoControllerSmokeTest extends InitTestEnvironment{
} }
/** /**
* 获取节点版本信息-id为null * A 6 get version id null exception test.
* @throws Exception *
* @throws Exception the exception
*/ */
@Test @Test
public void a6_getVersionIdNullExceptionTest() throws Exception { public void a6_getVersionIdNullExceptionTest() throws Exception {
@ -252,8 +259,9 @@ public class DeviceNodeInfoControllerSmokeTest extends InitTestEnvironment{
} }
/** /**
* 获取节点版本信息-id为"abd" * A 7 get version id character exception test.
* @throws Exception *
* @throws Exception the exception
*/ */
@Test @Test
public void a7_getVersionIdCharacterExceptionTest() throws Exception { public void a7_getVersionIdCharacterExceptionTest() throws Exception {
@ -279,8 +287,9 @@ public class DeviceNodeInfoControllerSmokeTest extends InitTestEnvironment{
} }
/** /**
* 获取节点版本信息-id为整形 * A 8 get version id integer exception test.
* @throws Exception *
* @throws Exception the exception
*/ */
@Test @Test
public void a8_getVersionIdIntegerExceptionTest() throws Exception { public void a8_getVersionIdIntegerExceptionTest() throws Exception {
@ -305,8 +314,9 @@ public class DeviceNodeInfoControllerSmokeTest extends InitTestEnvironment{
} }
/** /**
* 获取设备信息-获取存在的一个节点设备信息 * B 1 get device info normal one exist device test.
* @throws Exception *
* @throws Exception the exception
*/ */
@Test @Test
public void b1_getDeviceInfoNormalOneExistDeviceTest() throws Exception { public void b1_getDeviceInfoNormalOneExistDeviceTest() throws Exception {
@ -341,8 +351,9 @@ public class DeviceNodeInfoControllerSmokeTest extends InitTestEnvironment{
} }
/** /**
* 获取设备信息-获取多个节点设备信息 * B 2 get device info normal several device test.
* @throws Exception *
* @throws Exception the exception
*/ */
@Test @Test
public void b2_getDeviceInfoNormalSeveralDeviceTest() throws Exception { public void b2_getDeviceInfoNormalSeveralDeviceTest() throws Exception {
@ -377,8 +388,9 @@ public class DeviceNodeInfoControllerSmokeTest extends InitTestEnvironment{
} }
/** /**
* 获取设备信息-获取不存在的一个节点设备信息 * B 3 get device info normal one not exist device test.
* @throws Exception *
* @throws Exception the exception
*/ */
@Test @Test
public void b3_getDeviceInfoNormalOneNotExistDeviceTest() throws Exception { public void b3_getDeviceInfoNormalOneNotExistDeviceTest() throws Exception {
@ -413,8 +425,9 @@ public class DeviceNodeInfoControllerSmokeTest extends InitTestEnvironment{
} }
/** /**
* 获取节点设备信息-msgContent为空 * B 4 get device info empty msg exception test.
* @throws Exception *
* @throws Exception the exception
*/ */
@Test @Test
public void b4_getDeviceInfoEmptyMsgExceptionTest() throws Exception{ public void b4_getDeviceInfoEmptyMsgExceptionTest() throws Exception{
@ -436,8 +449,9 @@ public class DeviceNodeInfoControllerSmokeTest extends InitTestEnvironment{
} }
/** /**
* 获取节点设备信息-msgContent为null * B 5 get device info msg null exception test.
* @throws Exception *
* @throws Exception the exception
*/ */
@Test @Test
public void b5_getDeviceInfoMsgNullExceptionTest() throws Exception{ public void b5_getDeviceInfoMsgNullExceptionTest() throws Exception{
@ -459,8 +473,9 @@ public class DeviceNodeInfoControllerSmokeTest extends InitTestEnvironment{
} }
/** /**
* 获取节点设备信息-id为null * B 6 get device info id null exception test.
* @throws Exception *
* @throws Exception the exception
*/ */
@Test @Test
public void b6_getDeviceInfoIdNullExceptionTest() throws Exception{ public void b6_getDeviceInfoIdNullExceptionTest() throws Exception{
@ -480,9 +495,11 @@ public class DeviceNodeInfoControllerSmokeTest extends InitTestEnvironment{
Assert.assertTrue(msgContent.contains(String.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode()))); Assert.assertTrue(msgContent.contains(String.valueOf(ErrorCode.ERR_PARAMEXCEPTION.getCode())));
Assert.assertTrue(msgContent.contains(ErrorCode.ERR_PARAMEXCEPTION.getMsg())); Assert.assertTrue(msgContent.contains(ErrorCode.ERR_PARAMEXCEPTION.getMsg()));
} }
/**
* 获取节点设备信息-id为"abd" /**
* @throws Exception * B 7 get device info id character exception test.
*
* @throws Exception the exception
*/ */
@Test @Test
public void b7_getDeviceInfoIdCharacterExceptionTest() throws Exception{ public void b7_getDeviceInfoIdCharacterExceptionTest() throws Exception{
@ -505,8 +522,9 @@ public class DeviceNodeInfoControllerSmokeTest extends InitTestEnvironment{
} }
/** /**
* 获取节点设备信息-id为整型 * B 8 get device info id integer exception test.
* @throws Exception *
* @throws Exception the exception
*/ */
@Test @Test
public void b8_getDeviceInfoIdIntegerExceptionTest() throws Exception{ public void b8_getDeviceInfoIdIntegerExceptionTest() throws Exception{
@ -528,8 +546,9 @@ public class DeviceNodeInfoControllerSmokeTest extends InitTestEnvironment{
} }
/** /**
* 获取链接状态-获取在线的一个节点链接状态 * C 1 get link status normal one online device test.
* @throws Exception *
* @throws Exception the exception
*/ */
@Test @Test
public void c1_getLinkStatusNormalOneOnlineDeviceTest() throws Exception{ public void c1_getLinkStatusNormalOneOnlineDeviceTest() throws Exception{
@ -568,8 +587,9 @@ public class DeviceNodeInfoControllerSmokeTest extends InitTestEnvironment{
} }
/** /**
* 获取链接状态-获取在线的多个节点链接状态 * C 2 get link status normal several device test.
* @throws Exception *
* @throws Exception the exception
*/ */
@Test @Test
public void c2_getLinkStatusNormalSeveralDeviceTest() throws Exception{ public void c2_getLinkStatusNormalSeveralDeviceTest() throws Exception{
@ -608,8 +628,9 @@ public class DeviceNodeInfoControllerSmokeTest extends InitTestEnvironment{
} }
/** /**
* 获取链接状态-获取不在线的一个节点链接状态 * C 3 get link status normal one not online device test.
* @throws Exception *
* @throws Exception the exception
*/ */
@Test @Test
public void c3_getLinkStatusNormalOneNotOnlineDeviceTest() throws Exception{ public void c3_getLinkStatusNormalOneNotOnlineDeviceTest() throws Exception{
@ -648,8 +669,9 @@ public class DeviceNodeInfoControllerSmokeTest extends InitTestEnvironment{
} }
/** /**
* 获取链接状态 - msgContent为空 * C 4 get link status msg empty exception test.
* @throws Exception *
* @throws Exception the exception
*/ */
@Test @Test
public void c4_getLinkStatusMsgEmptyExceptionTest() throws Exception { public void c4_getLinkStatusMsgEmptyExceptionTest() throws Exception {
@ -671,8 +693,9 @@ public class DeviceNodeInfoControllerSmokeTest extends InitTestEnvironment{
} }
/** /**
* 获取链接状态 - msgContent为null * C 5 get link status msg null exception test.
* @throws Exception *
* @throws Exception the exception
*/ */
@Test @Test
public void c5_getLinkStatusMsgNullExceptionTest() throws Exception { public void c5_getLinkStatusMsgNullExceptionTest() throws Exception {
@ -694,8 +717,9 @@ public class DeviceNodeInfoControllerSmokeTest extends InitTestEnvironment{
} }
/** /**
* 获取链接状态 - id为null * C 6 get link status id null exception test.
* @throws Exception *
* @throws Exception the exception
*/ */
@Test @Test
public void c6_getLinkStatusIdNullExceptionTest() throws Exception { public void c6_getLinkStatusIdNullExceptionTest() throws Exception {
@ -717,8 +741,9 @@ public class DeviceNodeInfoControllerSmokeTest extends InitTestEnvironment{
} }
/** /**
* 获取链接状态 - id为"abd" * C 7 get link status id character exception test.
* @throws Exception *
* @throws Exception the exception
*/ */
@Test @Test
public void c7_getLinkStatusIdCharacterExceptionTest() throws Exception { public void c7_getLinkStatusIdCharacterExceptionTest() throws Exception {
@ -741,8 +766,9 @@ public class DeviceNodeInfoControllerSmokeTest extends InitTestEnvironment{
} }
/** /**
* 获取链接状态 - id为整型 * C 8 get link status id integer exception test.
* @throws Exception *
* @throws Exception the exception
*/ */
@Test @Test
public void c8_getLinkStatusIdIntegerExceptionTest() throws Exception { public void c8_getLinkStatusIdIntegerExceptionTest() throws Exception {
@ -764,9 +790,10 @@ public class DeviceNodeInfoControllerSmokeTest extends InitTestEnvironment{
} }
/** /**
* test Determine whether the Id exists.. * Verify device id exists boolean.
* *
* @return boolean true-exists * @param deviceId the device id
* @return the boolean
*/ */
public boolean verifyDeviceIdExists(String deviceId) { public boolean verifyDeviceIdExists(String deviceId) {
boolean exists = false; boolean exists = false;
@ -786,12 +813,3 @@ public class DeviceNodeInfoControllerSmokeTest extends InitTestEnvironment{
} }
} }
/**
* Revision history
* -------------------------------------------------------------------------
* <p>
* Date Author Note
* -------------------------------------------------------------------------
* 2020-05-08 lsx creat
*/