When writing tests for your application it is often desirable to avoid hitting the database.  Entity Framework allows you to achieve this by creating a context – with behavior defined by your tests – that makes use of in-memory data. This article wil…
原位地址:http://codetunnel.com/blog/post/what-is-a-mocking-framework-why-is-it-useful 今天我想讲下关于mocking frameworks,并且解释下他为什么有用处.我将给你们展示用和不用mocking framework两种测试方法. 假设我们已经有了一个Driver类: public class Driver { private IVehicle vehicleToDrive; public Driver(IVeh…
[译] 什么是Mocking framework?它有什么用? 原位地址:http://codetunnel.com/blog/post/what-is-a-mocking-framework-why-is-it-useful 今天我想讲下关于mocking frameworks,并且解释下他为什么有用处.我将给你们展示用和不用mocking framework两种测试方法. 假设我们已经有了一个Driver类: public class Driver { private IVehicle ve…
Today I want to talk about mocking frameworks and why they are useful. In order to do that I first need to propose a scenario to you in which we will be testing a piece of functionality in an application. I will show you how you would test it without…
今天我想讲下关于mocking frameworks,并且解释下他为什么有用处.我将给你们展示用和不用mocking framework两种测试方法. 假设我们已经有了一个Driver类: public class Driver { private IVehicle vehicleToDrive; public Driver(IVehicle vehicleToDrive) { this.vehicleToDrive = vehicleToDrive; } public bool Evasive…
Googletest - Google Testing and Mocking Framework https://github.com/google/googletest…
一.前言 在实际编写程序时,往往需要与数据库打交道,在单元测试中直接使用数据库又显得太重,如果可以方便的编写一些测试数据,这样更易于检测功能.如何模拟数据库行为便是本篇的主题.微软有教程说明Moq Entity Framework,需注意的是EF的版本必须是6以上.但在这篇教程中是直接使用DbContext,而自己的应用程序中都是用UnitOfWork模式.经过修改后也可以实现类似功能. 二.参考文献 https://msdn.microsoft.com/en-us/data/dn314429…
通过 Nuget 安装 2.   官网下载(官网不行点这里) 3.   帮助文档 商业版和免费版区别概览 MockingContainer 测试类准备:一般来说也是业务类 public class ClassUnderTest { private IFirstDependency firstDep; private ISecondDependency secondDep; public ClassUnderTest(IFirstDependency first, ISecondDependenc…
先从ORM说起吧,很多年前,由于.NET的开源组件不像现在这样发达,更别说一个开源的ORM框架,出于项目需要,以及当时OOP兴起(总不至于,在项目里面全是SQL语句),就自己开始写ORM框架.要开发ORM框架首先要了解ORM概念. ORM 对象关系映射,O(Object) 对象,在项目中就是实体,更加精确的来说就是数据Model,也可以说持久化类.R(Relation) 关系数据,M (Mapping)映射,将对象映射到关系数据,将关系数据映射到对象的过程. 更加直观理解就是,ORM 就是以OO…
转自:http://www.cnblogs.com/fecktty2013/archive/2014/09/26/entityframework-overview.html EF版本 .net framework和IDE版本 主要功能 EF(or EF3.5) Visual Studio 2008 SP1 (.NET 3.5 SP1) 基本的O/R映射支持,使用DB First开发模式 EF 4 Visual Studio 2010 (.NET 4.0) 支持POCO实体 延迟加载 提高单元测试…
前言 What's mocking and its benefits Mocking is an integral part of unit testing. Although you can run your unit tests without use of mocking but it will drastically slow down the executing time of unit tests and also will be dependent on external reso…
One of the challenges developers face when writing unit tests is how to handle external dependencies. In order to run a test, you may need a connection to a fully populated database, or some remote server; or perhaps there is a need to instantiate a…
当你写一个原型或者测试的时候,依赖整个object 是不可行和明智的.一个 mock object和 real object 有同样的接口(所以它可以像同一个使用),但是让你在运行时进行指定它应该如何被使用,它应当做什么(哪些方法应该被调用?以何种顺序?多少次?用什么参数?什么会被返回?) 注意:很容易弄混 fake objects 和 mock objects.实际上fakes 和 mocks意味着不同的事情在Test-Driven Development(TDD)社区: Fake objec…
Awesome系列的.Net资源整理.awesome-dotnet是由quozd发起和维护.内容包括:编译器.压缩.应用框架.应用模板.加密.数据库.反编译.IDE.日志.风格指南等. 算法与数据结构(Algorithms and Data structures) Algorithmia - Algorithm and data-structure library for .NET 3.5 and up. Algorithmia contains sophisticated algorithms…
就在昨天终于做了gtest的分享,我的预研工作终于结束了,感觉离我辞职的日子不远了,毕竟是专注java二百年啊,要告别实习啦.. 这篇是GoogleMock的简介文档,会在后边附带一个自己的例子. 一.什么是Google C ++ Mocking Framework? 当你写一个原型或测试,往往不能完全的依赖真实对象.一个mock对象实现与一个真实对象相同的接口,但让你在运行时指定它时,如何使用?它应该做什么?(哪些方法将被称为?什么顺序?多少次?有什么参数?他们会返回什么?等) 注意:很容易混…
http://scottge.net/2015/07/08/a-complete-list-of-net-open-source-developer-projects/?utm_source=tuicool NET Implementations .NET Core – Core .NET Framework C# Native – Compiles C# to native. Cosmos – C# Open Source Managed Operating System, an operat…
These are the contents of my training session about unit testing, and also have some introductions about how could we write better unit tests with NSubstitute framework. The related sessions: Unit Testing with NSubstitute Building the Testing Pipelin…
Indexes and search engines These sites provide indexes and search engines for Go packages: godoc.org gowalker gosearch Sourcegraph Contributing To edit this page you must be a contributor to the go-wiki project. To get contributor access, send mail t…
android studio 2.0创建一个空android moudle后, 会出现两个test目录,其中一个是Instrument Test, 另一个则是Unit Test Unit Test 和 Instrument Test 的区别: 在 Android Developer 给出的 Instrument Test 解释如下: Instrumented unit tests are unit tests that run on physical devices and emulators,…
解剖SQLSERVER 第六篇  对OrcaMDF的系统测试里避免regressions (译) http://improve.dk/avoiding-regressions-in-orcamdf-by-system-testing/ 当我继续添加新功能和新的数据结构支持进去OrcaMDF软件的时候,bug的风险不断增加 特别是当我开发一个很大的未知功能时,我不能预估结构和该结构的关联,为了降低风险,测试是很有必要的 单元测试 单元测试是在面向对象编程里测试源代码某一个功能的最小一部分的测试.一…
刚用上Moq,就用它解决了一个IUnitOfWork的mock问题,在这篇博文中记录一下. 开发场景 Application服务层BlogCategoryService的实现代码如下: public class BlogCategoryService : IBlogCategoryService { private IBlogCategoryRepository _blogCategoryRepository; public BlogCategoryServiceImp(IBlogCategor…
现在EF越来越流行了,很多时候业务成都是直接访问DbContext 和DbSet来操作数据的. 那么我们测试的时候如何来mock这2个对象了?现在时间很晚了, 就直接贴code吧 首先看看的我们DbContext的类吧: public class BloggerEntities : DbContext { public BloggerEntities() : base("BloggerEntities") { Configuration.ProxyCreationEnabled = f…
单元测试概述 测试并不只是测试工程师的责任,对于开发工程师,为了保证发布给测试环节的代码具有足够好的质量( Quality ),为所编写的功能代码编写适量的单元测试是十分必要的. 单元测试( Unit Test ,模块测试)是开发者编写的一小段代码,用于检验被测代码的一个很小的.很明确的功能是否正确,通过编写单元测试可以在编码阶段发现程序编码错误,甚至是程序设计错误. 单元测试不但可以增加开发者对于所完成代码的自信,同时,好的单元测试用例往往可以在回归测试的过程中,很好地保证之前所发生的修改没有…
原文: https://code.google.com/p/googlemock/wiki/V1_7_ForDummies 地址被墙了, 看起来费劲, 转载一份 Google C++ Mocking Framework for Dummies Updated Nov 21, 2013 by zhanyong...@gmail.com What Is Google C++ Mocking Framework? Why Google Mock? Getting Started A Case for…
[This post is based on a document authored by Ben Grover (a senior developer at Microsoft). It is our intention to integrate this information into the MVC 3 documentation on MSDN. We hope to hear from you and welcome any suggestions you might have.]…
本文由 伯乐在线 - nathanw 翻译,dopcn 校稿.未经许可,禁止转载! 英文出处:www.mokacoding.com.欢迎加入翻译小组. 几周前,我决定将将我在 mokacoding 上的创作更多集中在单元测试与验收测试,自动化和生产效率上,主要在iOS领域. 相关深入文章可以看看“通过 CocoaPods 为 iOS 项目创建 Calabash 并构建配置”和“用终端运行 Xcode 测试”. 这周我们要回过头来看看,或者说是站在更高的角度审视单元测试和验收测试,以及在云端运行持…
http://www.opensourcetesting.org/unit_c.php API Sanity AutoTest Description: An automatic generator of basic unit tests for a shared C/C++ library. It helps to quickly generate simple ("sanity" or "shallow"-quality) test cases for ever…
The third part of my Spring Data JPA tutorialdescribed how you can create custom queries by using query methods. This blog entry will describe how you can implement more advanced queries by using the JPA criteria API. If you have read the previous pa…
Unit Testing a zend-mvc application A solid unit test suite is essential for ongoing development in large projects, especially those with many people involved. Going back and manually testing every individual component of an application after every c…
Summary: Guest blogger, Dave Wyatt, discusses using Pester to analyze small pieces of Windows PowerShell code. Note   This is a five-part series that includes the following posts: What is Pester and Why Should I Care?Learn about a new test framework…