Questions tagged [isolation-frameworks]

An Isolation framework is a unit testing framework with a special ability to isolate the dependent code.

Simple example in case of c# .net is DateTime.Now, for a method say A, if it is dependent on DateTime.Now; isolation framework will provide a way to isolate this dependency, there by enabling You to create a UnitTest easily.

Examples of frameworks: Moles framework

15 questions
22
votes
3 answers

How Moles Isolation framework is implemented?

Moles is an isolation framework created by Microsoft. A cool feature of Moles is that it can "mock" static/non-virtual methods and sealed classes (which is not possible with frameworks like Moq). Below is the quick demonstration of what Moles can…
Buu
  • 49,745
  • 5
  • 67
  • 85
12
votes
6 answers

How could I refactor this factory-type method and database call to be testable?

I'm trying to learn how to do Unit Testing and Mocking. I understand some of the principles of TDD and basic testing. However, I'm looking at refactoring the below code that was written without tests and am trying to understand how it needs to…
JamesEggers
  • 12,885
  • 14
  • 59
  • 86
7
votes
4 answers

Which is the best isolation framework for Java? JMock, Easymock, Mockito, or other?

I realize this has been asked before, but the last time was in mid 2008. If you were starting a new project right now, which one would you use and why? What are their strengths/weaknesses regarding readability, usability, maintainability, and…
Dave
  • 21,524
  • 28
  • 141
  • 221
7
votes
1 answer

Streamlined Ruby code deployments

Here's my imagined development and deployment process: Create project directory my_project. Install the required Ruby version into it. Install the required gems. Write some code. Use fpm to package the whole thing. Ship the debian package to a…
David K.
  • 6,153
  • 10
  • 47
  • 78
7
votes
3 answers

Preferred unit testing isolation framework for .net

I have used the RhinoMocks product for quite some time and have been quite happy with the product - never had a reason to look elsewhere really. I was recently asked by the good folks at TypeMock to give their product a whirl and was wondering what…
Andrew Siemer
  • 10,166
  • 3
  • 41
  • 61
5
votes
2 answers

Isolation framework for testing for Mono

Having read good things about Moles I'd like to add an isolation framework to our set of tools for writing unit tests. Our application runs under Mono as it is deployed on both Linux and Windows and I cannot seem to find a framework that supports…
sebjsmith
  • 71
  • 5
4
votes
7 answers

Standards for Mock Objects

In Roy Osherove's book [Unit Testing][1] book, he explains that a single unit test should contain between 0 and 1 mocks. He suggests that if your test isn't asserting on the mock, then don't use a mock at all. He further demonstrates how to use an…
Brent Arias
  • 29,277
  • 40
  • 133
  • 234
4
votes
3 answers

Do we really need isolation frameworks to create stubs?

I have read this: http://martinfowler.com/articles/mocksArentStubs.html My concepts about a stub and a mock are clear. I understand the need of isolation frameworks like moq, rhinomocks and like to create a mock object. As mocks, participate in…
Sandbox
  • 7,910
  • 11
  • 53
  • 67
3
votes
3 answers

Unconstrained Isolation (mocking) framework for dotnet core

I'm working on a dotnet core project, trying to mock some third party classes in my Xunit.net tests. The class I'm trying to fake is not mockable through constrained frameworks like Moq or NSubstitute. So I need an unconstrained framework to do…
akardon
  • 43,164
  • 4
  • 34
  • 42
3
votes
0 answers

How do I record and replay method calls in c#.net for isolation testing of legacy code

I have a repository and a consumer of that repository in some legacy code. The consumer makes multiple method calls to the repository. Each method call returns a huge resultset. I do have an integration test that checks how the consumer and…
perfectionist
  • 4,256
  • 1
  • 23
  • 34
2
votes
2 answers

Has anyone made moles work properly?

I was trying to find a consistent description on how to use moles isolation framework but haven't found much on this topic. So far i did the following: Download moles from here (x86 version). Install it. Here guy describes how to use it with custom…
Puterdo Borato
  • 388
  • 4
  • 19
0
votes
2 answers

Can you recommend me a way to create a sample portion of a data-base as an xml file to be consumed by Unit Tests?

Can you recommend me a way or tell me the most common practice to create a sample portion of a data-base as an xml file so that I can use it from my unit tests without worrying about Db state to be persistent? Is there any frame work to overcome…
pencilCake
  • 51,323
  • 85
  • 226
  • 363
0
votes
1 answer

Is faking dependencies with interfaces or virtual methods a good design choice?

I am trying to learn unit testing but there is a design issue resulting from it. Consider class A has a dependency on class B. If you want to create a stub for B in order to unit test A, most isolation frameworks require that B has to be an…
Alp
  • 553
  • 11
  • 30
0
votes
1 answer

Am I creating fakes correctly with nsubstitue?

I got an assignment to learn how you use an isolation framework. And I was wondering if I am creating fakes the appropriative way with nsubstitute. Here is a sequence diagram of how the application shoud look like . I have then made unit tests and…
Sumsar1812
  • 616
  • 1
  • 9
  • 32
0
votes
1 answer

Using a Factory to replace instances by fakes from an Isolation Framework

A month ago I finished reading the book "Art of Unit Testing" and today I finally had time to start using Rhino Mocks with unit testing a service that sends/receives messages to devices (UDP) and saves/loads data from the database. Off course I…
pauloya
  • 2,535
  • 3
  • 30
  • 50