zoukankan      html  css  js  c++  java
  • 单元测试编写规范、问题、解决

    前置步骤

    1. 所有单测的上一级目录下 新建 BaseTestCase
      public class BaseTestCase {
      @Before
      public void init_mocks() {
          MockitoAnnotations.initMocks(this);
      }
      }
      
    2. 具体的单测类
      @RunWith(PowerMockRunner.class)
      @WebAppConfiguration
      @Log4j2
      public class BaseDataApiServiceImplTest extends BaseTestCase{
      	@InjectMocks
      	private static InnerDataApiServiceImpl client;
      	@Mock
      	private static InterfaceCallLogService interfaceCallLogService;
       	@Before
      	public void setUp() throws Exception {
          	client = new InnerDataApiServiceImpl();
          	ReflectionTestUtils.setField(client, "interfaceCallLogService", interfaceCallLogService);
      }
      	@SneakyThrows
      	@Test
      	public void getApiDataByInterfaceName() {
      		String interfaceName = CommonConstants.TEST_INTERFACENAME;
      		String inputParams = CommonConstants.TEST_INPUTPARAMS;
      		String accessToken = CommonConstants.TEST_ACCESSTOKEN;
      		client.getApiDataByInterfaceName(interfaceName, inputParams, accessToken);
      		}
      	}
      

    主要参数释义

    对应问题与解决

    初晨暖阳,夜落星河。 少年披梦,远方有歌。 红黄之上,春夏晚风。 闲肆游走,人群熙攘。
  • 相关阅读:
    本学期3个sprint的团队贡献分
    sprint3个人总结
    12.17第九天
    阶段二总结
    sprint 1 总结
    冲刺一
    课程设计团队信息
    学习进度表
    Sprint3总结
    Res_Orders_02
  • 原文地址:https://www.cnblogs.com/alidata/p/15160468.html
Copyright © 2011-2022 走看看