zoukankan      html  css  js  c++  java
  • 基于SOA架构的TDD测试驱动开发模式

      以需求用例为基,Case&Coding两条线并行,服务(M)&消费(VC)分离,单元、接口、功能、集成四层质量管理,自动化集成、测试、交付全程支持。 3个大阶段(需求分析阶段、研发准备阶段、研发测试阶段)16个小历程(*)确定好边界,明确好对接产物,做好服务管理。

    一、抽象接口

      根据拆分的需求,将本轮迭代所要实现的功能抽象出来。

    public interface IUserInfoInterface{
        /**
         * 功能:校验用户是否绑定了手机号<br>
         * @param account 账号(必填项),例如:admin@123456
         * @return 结果视图
         * @version [0.0.1, 2016-07-12]
         */
        CommonResult<UserInfoEntity> checkHandphoneBindingByAccount(String account);
        /**
         * 校验手机号是否已被绑定
         * @param handphone 手机号,例如:13999999999
         * @return 结果视图
         * @version [0.0.1, 2016-07-26]
         */
        CommonResult<UserInfoEntity> checkHandphoneBinding(String handphone);
    }

    二、构建项目至Nexus(maven deploy)

      使用Jenkins持续集成,并提供pom三维坐标

    <groupId>com.cnblogs</groupId>
    <artifactId>user-interfaces</artifactId>
    <version>1.1.2-SNAPSHOT</version>

    三、Case&Coding俩条线并行

      case调用接,编写用例

    import com.*.*.interfaces.TUserInfoInterface.service.IOpenTestInterfaces;
    import com.*.*.interfaces.user.inf.IUserInfoInterface;@Service("openTestInterfaces") public class OpenTest implements IOpenTestInterfaces { @Autowired private IUserInfoInterface tUserInfoInterface; @Override public String login(String account, String password, String identifyingCode,String loginChannel) { CommonResult<UserInfoEntity> login = tUserInfoInterface.login(account, password, identifyingCode,loginChannel);     // 操作码     String optCode = login.getOptCode();     // 操作描述     String optDesc = login.getOptDesc();     // 结果码     String resultCode = login.getResultCode();     // 结果描述     String resultDesc = login.getResultDesc();     // 返回数据     EsiUserInfoEntity data = login.getData();     // 系统码     String module = login.getModule().getModuleCode();     // 业务码     String bizCode = login.getBizCode();     //操作是否成功     Boolean isSuccess = login.isSuccess();     result = new TestResult(optCode, optDesc, resultCode, resultDesc, data, module, bizCode,isSuccess).toString();     return result; }

      coding实现接口

    import com.*.*.user.service.inf.UserInfoService;
    import com.*.*.interfaces.user.inf.IUserInfoInterface; @Service(
    "UserInfoService") public class UserInfoServiceimpl implements UserInfoService{ @Override public CommonResult<UserInfoEntity> login(String account,String password,String identifyingCode,String loginChannel){ CommonResult<UserInfoEntity> cr = new EsiResult<>(); //账户非空校验 if(StringUtils.isEmpty(account)){ cr.setResult(ResultCode.ACCOUNT_EMPTY_CODE); return cr; } try{ UserInfoEntity userInfoEntity_account = getUserInfoEntityByAccount(account); //校验账户是否存在 if(userInfoEntity_account == null){ cr.setResult(EsiResultCode.ACCOUNT_NOT_EXISTS_CODE); return cr; }catch(Exception e){ log.error("登陆校验发生错误", e); cr.setResult(ResultCode.UNKNOWN); return cr; } return cr; }

    四、持续集成

      写完用例后以消费者身份注册zk等待提供者。

      研发完成服务(ws)后,使用Jenkins构建项目,集成到dubbo_zk管理中心。

      与此同时,dubbo管理台接口现实提供者并状态显示正常。

    五、测试用例=API?

      页面太丑,五脏俱全。

    六、3个大阶段(需求分析阶段、研发准备阶段、研发测试阶段)16个小历程(*)

  • 相关阅读:
    Oracle expdp 多表导出处理
    字符串
    Java设计模式
    多线程
    Java面向对象练习
    Java面向对象基础
    Java基础算法
    Java常识
    DOS基础命令(1)
    Java基础练习
  • 原文地址:https://www.cnblogs.com/Javame/p/5833885.html
Copyright © 2011-2022 走看看