BDD实战篇 - .NET Core里跑Specflow - 可以跑集成测试和单元测试

时间:2023-01-27 15:18:19
这是<如何用ABP框架快速完成项目 >系列中和DevOps系列文章其中一篇文章。
 
 
上一篇文章说了如何在.NET Core里安装Specflow. 然而文章成果只到了hello world级别。
要想真的和实际业务结合,比如要能够IOC new class实例和能够调用数据库和第三方服务。用专业术语来说,就是能跑集成测试和单元测试。这就是这篇文章的目的了。
 
和.NET不一样的是,.NET Core取消了App.config,并且整个机制都改变了。导致很多.NETer转.NET Core的时候一脸懵逼
 
所以在.NET Core下运用BDD/TDD也不一样了。这篇文章就讲讲如何配置。
 
  1. 原来app.config一分为二,specflow部分划为specflow.json,在这篇文章里有提到。其他划为appsetting.json
  2. 文件格式也从原来的xml文档变为json文档。
  3. 同时还需要把appsetting.json文件属性设置为如下
    BDD实战篇 - .NET Core里跑Specflow - 可以跑集成测试和单元测试aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAV4AAACbCAYAAAAqefOpAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAABadSURBVHhe7Z3PjxzHdceXFPJP5KRjnCMpGNy1mPwBgS4BBMNCoKXJ3ZWSiwUEgU6BDiQYJwbXaycQ4ogOGB8S0loiiVZcIYaTQDklEUVCUmJRWstwAvgiIEtJNnIIZHbqW12v+1X1q/4xO9M7s/N9wgfbXVVd3V1T/ZnH2tnRyhdWny4IIWSe+LUnf/tEQ/ESQuYOS1YniZXtV35YEELIPLFz/Qcnkki8xWffJYQQMkMoXkIIGRmKlxBCRobiJYSQkaF4CSFkZCheQggZmV7i/fDq48XKykonG7vXfftH979cPHHmy8WHn5b7uh9pQwghx8EfXDrfwGo3S3qL94mrV8064c56XrxSR/ESQo4bLdq5F6+V4aZE4kXZ+teKR59+rdhYOV/ccRKmeAkhx81RxPva957z7f9l7/cbdShDHdqkdSkTZ7yPds+bWbAvX3e4jPfO1fPFxnpe2l1ZNCGETJujiBdY8h0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JDdQ2hnOJdXDDH4siLVy8rxJ/dZcbLmDwWQryETBPMMQbjOIPiJUsH5hiDcZxB8ZKlA3OMwTjOgDiPCubxVMU7K6z/xc68Yl0/IYRoKN4pY10/IYRoKN4pY10/IYRoKN4pY10/IYRoIvHuXP+BKRPSH2uQCSFE0yre6C96Muj2bRze/UZx9tTpYv3WL8x6cPtZ1fdj68XuzYvRuSKevW32cdxYg0wIIZpO8er9lK56kW0kTI2T6+2Hn0THePkm5YdBwF+88l7Udh6xBpkQQjQzFa8GQj116mxx9W65ZqsF67fPXSne+fjnUfnbl1drSSt0P/OGNciEEKIZRbxV5hvkijIR7O7hveLyObcdlg4a4jWyX4qXELLI9BKvZJoaXd9GJd1EoGk2K8sIlni1nCleQsiiM9OM10tUSfXjw3dLgSYS1lC8hJCTziji7UNbxvvq/+wWXzldtqF4CSGLzmi/XAMTZ7zhUw34KBrFSwhZdDrF24Vun8ML9NyV4t7D+5V4d/3a7xMNgUqWLHKtZK3KdPt5wxpkQgjRtIp3GkCkEObXb32/ePXu25V4sX3v5qVS4PoTDdgPn344PCyXGFB28WZY51X16bnmAWuQCSFEM1PxepEGSfqsF9J06D+EqOSa/CVa1T4pz7WfF6xBJoQQzcwz3mXDGmRCCNFQvFPGGmRCCNFQvFPGGmRCCNFQvFPGGmRCCNFMVbwMxiwDE5bBWPSIxft08f9zQFuoyUYyxAAAAABJRU5ErkJggg==" alt="" />
  4. 读取配置的方式也从原来的system.configmanager.appsetting变为 IConfigurationRoot[key]方式。示例代码如下:
        public class AppEnvConfiguration : ITransientDependency
    {
    private readonly IConfigurationRoot _appConfiguration; public bool IsEnableADFS => bool.Parse(_appConfiguration["ExternalAuth:WsFederation:IsEnabled"]); public AppEnvConfiguration(IAppConfigurationAccessor configurationAccessor)
    {
    _appConfiguration = configurationAccessor.Configuration;
    }
    }

      

 
Q&A:
  1. 为啥集成测试里面数据库返回结果数目总是0?
    答:检查一下测试项目目录\bin\Debug\netcoreapp2.1目录下有没有appsetting.json这个文件,没有则看看有没有做上面的第3步. 或者用如下代码去检查能否正常读取到数据库ConnectionString
    string conString = Microsoft
    .Extensions
    .Configuration
    .ConfigurationExtensions
    .GetConnectionString(this.Configuration, GHITAssetNgConsts.ConnectionStringName);

      如果还是解决不了,则先阅读这篇文章这篇文章
    PS:有人反映上面两篇文章全英文,看不懂!好吧,我就讲重点吧。

    ABP的Test项目默认是只支持mock和EFInMemoery的,不支持集成测试所需要的真实数据库连接,所以我们要么就搞双兼容,要么就另开一个测试project单独去做集成测试。双兼容关键代码如下:

    public class XXXTestModule : AbpModule
    {
    private readonly IConfigurationRoot _appConfiguration; bool 使用UAT真实数据库而不是Mock或者EFInMemory = true;
    public XXXTestModule(XXXEntityFrameworkModule abpProjectNameEntityFrameworkModule)
    {
    if (使用UAT真实数据库而不是Mock或者EFInMemory)
    {
    abpProjectNameEntityFrameworkModule.SkipDbSeed = true; _appConfiguration = new ConfigurationBuilder()
    .AddJsonFile("appsettings.json")
    .AddEnvironmentVariables()
    .Build();
    }
    else
    {
    abpProjectNameEntityFrameworkModule.SkipDbContextRegistration = true;
    abpProjectNameEntityFrameworkModule.SkipDbSeed = true;
    }
    } public override void PreInitialize()
    {
    Configuration.UnitOfWork.Timeout = TimeSpan.FromMinutes(30);
    Configuration.UnitOfWork.IsTransactional = false; // Disable static mapper usage since it breaks unit tests (see https://github.com/aspnetboilerplate/aspnetboilerplate/issues/2052)
    Configuration.Modules.AbpAutoMapper().UseStaticMapper = false; Configuration.BackgroundJobs.IsJobExecutionEnabled = false; // Use database for language management
    Configuration.Modules.Zero().LanguageManagement.EnableDbLocalization(); if (使用UAT真实数据库而不是Mock或者EFInMemory)
    {
    if (Configuration == null) throw new NullReferenceException($"{nameof(Configuration)} is null");
    Configuration.DefaultNameOrConnectionString = _appConfiguration.GetConnectionString(
    GHITAssetNgConsts.ConnectionStringName
    );
    }
    else
    {
    RegisterFakeService<AbpZeroDbMigrator<XXXDbContext>>();
    } Configuration.ReplaceService<IEmailSender, NullEmailSender>(DependencyLifeStyle.Transient);
    }

      

    public abstract class XXXNgTestBase : AbpIntegratedTestBase<XXXTestModule>
    {
    void NormalizeDbContext(XXXDbContext context)
    {
    context.EntityChangeEventHelper = NullEntityChangeEventHelper.Instance;
    context.EventBus = NullEventBus.Instance;
    context.SuppressAutoSetTenantId = true;
    } protected XXXNgTestBase()
    {
    var 使用UAT真实数据库而不是Mock或者EFInMemory = true; if (使用UAT真实数据库而不是Mock或者EFInMemory)
    { }
    else
    {
    // Seed initial data for host
    AbpSession.TenantId = null;
    UsingDbContext(context =>
    {
    NormalizeDbContext(context);
    new InitialHostDbBuilder(context).Create();
    new DefaultTenantBuilder(context).Create();
    }); // Seed initial data for default tenant
    AbpSession.TenantId = 1;
    UsingDbContext(context =>
    {
    NormalizeDbContext(context);
    new TenantRoleAndUserBuilder(context, 1).Create();
    }); LoginAsDefaultTenantAdmin();
    }
    }

      

    至于为啥不是像ABP官网所说的去配置呢?因为ABP官网说的这种配置方法不是用于集成测试的,而是用于单元测试的。

 
通过以上步骤,终于可以调用数据库和第三方服务来跑集成测试了。然而还有一个很大问题,单元测试跑不过啊!!!
 
为什么会跑不过呢?
因为BDD和TDD不一样。
TDD的Test case是可以直接继承ABP里面的XXXTestBase基类的,这个基类里面提供了IOC new class实例等一系列很有用的方法。
但是BDD的Specflow却是Test Case和Step Definition分离的。在Step Definition里面是无法调用XXXTestBase基类里的这些方法的。
 
那怎么办呢?
照如下步骤办即可:
  1. 新增一个TestBaseWrappers文件夹
  2. 然后根据实际业务从最小化角度来建立TestBaseWrapper类
  3. 在这个类里面写IOC代码
  4. 然后再Step Definition类里调用这些TestBaseWrapper类。
 
Q&A:
  1. 为什么不用Step Definition类直接继承ABP里面的XXXTestBase基类呢?
    答:首先会报错。然后我在这篇文章里面说到,我们只有一个Step Definition类,然后分布在多个文件,通过Partial关键字来组合。所以如果Step Definition这么大的一个类来直接继承TestBase基类,然后在TestBase基类里构造函数来IOC初始化所有要调用Service类实例,第一会遇到性能问题,第二会遇到循环调用问题,这画面太美不敢看啊。
  2. 报错:Message: System.InvalidOperationException : Mapper not initialized. Call Initialize with appropriate configuration. If you are trying to use mapper instances through a container or otherwise, make sure you do not have any calls to the static Mapper.Map methods, and if you're using ProjectTo or UseAsDataSource extension methods, make sure you pass in the appropriate IConfigurationProvider instance.如何解决?
    BDD实战篇 - .NET Core里跑Specflow - 可以跑集成测试和单元测试aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAuUAAAEHCAYAAAAJXjjqAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAC7cSURBVHhe7dvdkis5jqXReZW8yIt8/wfsGXQn5uxCAyDocon6+ZYZ7TiBTbikiFC5lVX9n/8CAAAAcBQP5QAAAMBhPJQDAAAAh/FQDgAAABzGQzkAAABwGA/lAAAAwGE8lAMAAACH8VAOAAAAHMZDOQAAAHDYTzyU//X3P/9/AQAAAO/mZQ/l0wfjaW7H3TN13nQBAAAAFR7K/5/d++m86XqFV94LAAAA9/mJh/LOXfe7a85Vp+8PAACA63gov+l+d8256vT9AQAAcB0P5Tfd7645V52+PwAAAK77qIfyrKc1rausr7Vs7Zqe1dzVvC2X9XSprG8LAAAAZ330Q7nudUVZT2vZ2jU5q5lsRVnGl8t6ulzW8wUAAICzPvahPPanvajr7VjNqfq7dVPVunzXAwAAwFkf/z9fUVW/qpuut6Ob0/VM1s9qnS7f9QAAAHAeD+VNb0c3p+uZrK81rVe6rPayPgAAAM7iobzp7ejmaG+1VNa3ldnp6wIAAMB5PJQ3vR3dHO2tVmaS63pKc5M8AAAAno+H8qa3o5vT9XbonDirqlc0Pz0DAACA53jZQ7lZPQQ+q1/VTdfb0c3peruqWVW9c+UMAAAA7nfsoTw+CHY9d7Vf1U3X27GaM+mr3TlV3WQ1050BAADA67z0odzog2C1KqtM1a/qRnu6dk3OaiZbKuvrirKMra7nCwAAAGe9/KHcZA+GtlZW2apf1Z32u1xnelZzuqI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nvKeZ7nw2y2q6XJZ13ptmquX9KKu5u3rVfauVyepdVpfq9rGnutxqhtV0uSzrvDfNVMv7z5TN19eg/ZiNe6Pn4gLw/Xgo/5f3qkys6766VndkrBbrO/vYU96rMpOzrpql+8m8KjOZU2WqfGS5Luv9ajm9jrw3zXTL6bWK9dVeea86082y61W/4r1HMybrT+ZmdntW03p3vhLPZPtJRuk+9lR1bjVv1a9479GMWfWd5arV0X6Wj/0onskyAH7HVzyUm8mXWZfxXpWJdd1X1+qOzKTW7bPzzntVZnLWVbN0P5lXZSZzqkyVr0zmR9P7ee+ujKlysb7aK+9VZ7pZsWdWfee9RzMm60/mZh7tdZlKPLPam50z2XlXndudt+o77z2aMav+o3R+dq9V33mvywD4fl/1UD75QssyWqtmxHp3JtvH/CQTrc6Y3b3RWtY3Vd2sZrpYu5Kxvdbi3mQZFfedKtvNiPfOslcyldWsqhatanecsX3sx4zZzZgs4ybnVdczu/OM9ldZZdmYn+yvnMlk9VUtmx37MWN2MybLuK53B52fva6ur67kAHyfr3kod/alFVfU9bO86XJZT5fX1Cqj16o7Y7RnYt94JmZNljdan5zZqemKsn7MrTJ67TTvK6u76rriGf1Xl1pl9LoS87q8prSnvJ71q3yUnfPle6c1XWqScTHjOf9XZTWnvSpndV3Rbt8zVV1l9Ziv+i72jWc0W+WiWPMZXte+1nSpScbFjOf832eJ87v7x2tdUex7xv8F8J2+7qH8XfFlisov/25M3vszP59sNn+rz3f65/6J+DyA78dD+YvwhYrKL/9unH44y2bzt/p8p3/un4jPA/h+PJS/AF+m6Pzy78c7PJzpfP5WX+Mdfu4A8G54KH8C+w8TXUDnl39HJu+dv6Hvw88dAP43HsoBAACAw3goBwAAAA7joRwAAAA4jIdyAAAA4DAeygEAAIDDeCgHAAAADuOhHAAAADiMh3IAAADgMB7KAQAAgMN4KAcAAAAO46EcAAAAOIyHcgAAAOCo//qv/wsjL589mRrhBgAAAABJRU5ErkJggg==" alt="" />
    所以这道题是我面试必选题之一!!凡是在ABP项目里面使用MapTo扩展方法而不是使用IObjectMapper的,绝对是没写过单元测试的!这样子一下就可以判断出面试者有没有写过单元测试了!!!
  3. 为啥你讲了这么多测试方面的知识,开发的知识却很少?
    答:因为:
    1. 无论是TDD还是BDD,都是测试驱动,先写测试代码然后再写业务开发代码
    2. 讲ABP开发的文章太多,不缺我一个,然而讲用ABP去做BDD/TDD的文章却很少,很需要我去补充
    3. 我现在自己创业,自负盈亏,不像很多开发人员,每月固定有工资,旱涝保收,可以放心的去空谈理论。所以我一切以出活为主,以交付实际成果为第一目标,而不是以理论和空谈为目标。BDD/TDD可以避免把宝贵的时间投入到项目实际上不需要的理论方面,可以保证我做的东西是客户所想要的。所以我强烈推荐BDD这个核武器。
    4. 在上一点里面我说出了核心,如何保证你所做的东西就是客户想要的?这就是BDD与TDD相比,BDD最大的优点啦!!!毕竟,绝大多数情况下,业务人员会比开发人员更了解业务!