zoukankan      html  css  js  c++  java
  • 打造第二代测试框架TestDriven 2.0(五)—— 测试框架初步展示

    ------------------ 

    前言 Preface

    ------------------ 

    本文是第二代测试框架系列文章,同时也是软件工程革命三部曲中的技术文献。

    本文展示了测试驱动框架的原型,系统稳定后会放出源代码。

     

    ------------------ 

    效果展示 Gallary

    ------------------ 

    1. 自动生成测试代码

     

    代码

    using System;
    using System.Collections.Generic;
    using System.Text;
    using Pixysoft.TestDrivens;
    using Pixysoft.Framework.AutoUpdates;

    namespace Pixysoft.Framework.AutoUpdates.TestDrivens
    {
        [TestDriven(TestDrivenType.UnitTest, 
    "Pixysoft.Framework.AutoUpdates.Class1"typeof(Pixysoft.Framework.AutoUpdates.Class1))]
        
    class UnitTest_000_Class1
        {
        
            [TestCase(
    "hello")]
            
    public static void TestCase_000_hello()
            {


            }




        }
    }

    2. 运行当前方法的单元测试:

    代码
    using System;
    using System.Collections.Generic;
    using System.Text;
    using Pixysoft.TestDrivens;
    using Pixysoft.Framework.AutoUpdates;

    namespace Pixysoft.Framework.AutoUpdates.TestDrivens
    {
        [TestDriven(TestDrivenType.UnitTest, 
    "Pixysoft.Framework.AutoUpdates.Class1"typeof(Pixysoft.Framework.AutoUpdates.Class1))]
        
    class UnitTest_000_Class1
        {

            [TestCase(
    "hello")]
            
    public static void TestCase_000_hello()
            {
                Assert.IsEqual(
    "pixysoft"new Class1().hello());
                Assert.IsEqual(
    "hello"new Class1().hello());
                
    try
                {
                    
    throw new Exception("test exception");
                }
                
    catch (Exception ex)
                {
                    LoggerHelper.Fatal(ex);
                }
            }
        }
    }

    3. 查看当前运行的日志

    4. 升级测试代码

    ------------------ 

    后记

    ------------------ 

    基本功能都实现了,不过效果和易用性有待优化。

  • 相关阅读:
    20145204《信息安全系统设计基础》期中总结
    20145204&20145212信息安全系统实验一报告
    k8s运维记
    服务器免密登录
    非正常关闭vi编辑器产生swp文件怎么删除
    centos7 安装 python3 、docker、 docker-compose 脚本
    数据库高可用方案
    centos7安装docker-compose报错解决办法
    centos7 一键安装python3 --转发
    安装docker-compose的两种方式
  • 原文地址:https://www.cnblogs.com/zc22/p/1689318.html
Copyright © 2011-2022 走看看