Free Mocking Framework

For developers who practice unit testing and want to deliver exceptional software, JustMock Lite is the superior free mocking framework that makes unit testing simpler for SOLID testable projects. JustMock Lite is an open source product that is easy to use, feature rich, with great power and flexibility, making it the superior choice. JustMock Lite cuts your development time and helps you create better unit tests. It enables you to perform fast and controlled tests that are independent of external dependencies like databases, web services or proprietary code.

Like any open source software, JustMock Lite allows for full code transparency as well as easy product update and support by the community. JustMock Lite is the same set of assemblies as the commercial edition of JustMock, and just like JustMock, it is commercially backed with 3 major releases per year and continuous product improvement. 

If you are dealing with a legacy code project or tightly coupled code that requires elevated mocking (such as mocking private, static, or sealed items), you need the JustMock full edition.

Download JustMock Lite

Go to GitHub to see the code and contribute

NuGet Package for Visual Studio


Why Choose?

Superior Free Mocking Framework

JustMock Lite integrates with all .NET unit testing frameworks, and works with all .NET continuous integration/build servers. JustMock Lite helps unit test a complex behavior by easily isolating dependencies, allowing for higher code coverage as well as exposing bugs and side effects from code changes. It offers automatic feedback as a step in verifying expected behavior of the system under test. JustMock Lite enables you to quickly add use cases to your unit tests, expanding scenario coverage. JustMock Lite supports a long list of features, including automocking, ordered assertions, mocking events and sequential mocking, all with an easy to discover fluent interface. Take a look at the table below for a list of features and comparison with the JustMock full edition.

Commercially Backed

JustMock Lite follows the same release cycle as JustMock full edition with 3 major releases per year, each introducing cutting edge improvements and new features.

Open Source

JustMock Lite shares the same set of assemblies as the commercial edition of JustMock. The parts that are not shared between the two versions, and therefore remain closed source, are the Telerik digital signature, the profiler responsible for elevated mocking, and the Visual Studio extension. Everything else is open source and accessible on GitHub for everyone to see.

Now you can easily add the functionality that you need and want without having to wait for new features or bug fixes. Share your features and solutions with the larger community so that anyone can benefit from them and you can benefit from everyone else’s fixes and additions. Plus, you can examine the source code and verify what the code does so there are no surprises.

To learn more about open sourcing JustMock Lite, check out our blog post.

Mocks SOLID Code

If your code follows the SOLID principles, then JustMock Lite is the right framework for you. If your code is designed for testability and is loosely coupled, JustMock Lite will help you write high quality software through fast and easy unit testing. If your project contains legacy code, use the JustMock full edition for elevated mocking. The table below shows a full comparison between the two editions of JustMock.

Arrange, Act, Assert Oriented

JustMock Lite utilizes the Arrange, Act, Assert (AAA) pattern for creating unit test mocks. This simple pattern makes it easy for developers to quickly and naturally mock objects in unit tests.

Error-Free Mocking

Thanks to its strongly typed framework API, JustMock detects errors in your mock definitions and highlights them in Visual Studio. The JustMock Lite API fully leverages Visual Studio IntelliSense to make it easy to start mocking.

Automocking

Automocking eliminates the time and effort needed to manage mocking the dependencies in the system under test by automating the process. Automocking provides significant benefit to testing classes with many dependencies or dependencies that change over time.

Easy Migration to JustMock Full Edition

When you decide you need a more powerful mocking experience you can easily migrate to the paid version of JustMock. With it you can mock objects like non-virtual methods, sealed classes and static methods and classes, non-public members and types.

Explore JustMock full edition.

JustMock Edition Comparison

Feature JustMock Full Edition
JustMock Lite Edition
Call Original?The CallOriginal method marks a mocked method/property call that should execute the original method/property implementation. This topic goes through a number of scenarios where the CallOriginal method is usefull.
Do Nothing?The DoNothing method is used to arrange that a call to a method or property should be ignored. It is applicable only for methods without a return value and property sets.
Do Instead?The DoInstead method is used to replace the actual implementation of a method with a mocked one. This topic goes through a number of scenarios where the DoInstead method is useful.
Must Be Called?The MustBeCalled method is used to assert that a call to a given method or property is made during the execution of a test.
Raise?The Raise method is used for raising mocked events. You can use custom or standard events.
Returns?The Returns method is used with non void calls to ignore the actual call and return a custom value. This topic goes through a number of scenarios where the Returns method is useful.
Throws?The Throws method is used to throw an exception when a given call is made. This topic goes through a number of scenarios where the Throws method is useful.
Generics?Telerik JustMock allows you to mock generic classes/interfaces/methods in the same way as you do it for non-generic ones.
Strict Mocking?By default Telerik JustMock uses loose mocks and allows you to call any method on a given type. No matter whether the method call is arranged or not you are able to call it. However, you may have a case where you want to enable only arranged calls and to reject any other calls. In such cases you need to set the to Strict when creating the mock.
Mock Properties?Mocking properties is similar to mocking methods, but there are a few cases that need special attention like mocking indexers and particular set operations.
Asserting Occurrences?Occurrence is used in conjunction with Mock.Assert and Mock.AssertSet to determine how many times a call has occurred.
Matchers?Matchers let you ignore passing actual values as arguments used in mocks. Instead, they give you the possibility to pass just an expression that satisfies the argument type or the expected value range.
Sequential Mocking?Sequential mocking allows you to return different values on the same or different consecutive calls to one and the same type. In other words, you can set up expectations for successive calls of the same type.
Recursive Mocking?Recursive mocks enable you to mock members that are obtained as a result of "chained" calls on a mock. For example, recursive mocking is useful in the cases when you test code like this: foo.Bar.Baz.Do("x").
Mock Internal Types Via Proxy?With JustMock you can mock internal types with InternalsVisibleToAttribute the same way you mock public types. Without InternalsVisibleToAttribute you are forced to mock as you mock non-public members.
Automocking?Automocking allows you to create an instance of a class (the system under test) without having to explicitly create each individual dependency as a unique mock. The mocked dependencies are still available if methods or properties need to be arranged as part of the test.
Raises?The Raises method is used to fire an event once a method is called.
Elevated Silverlight Mocking?JustMock enables you to mock classes/members from Silverlight assemblies. You are no longer bound to refering your legacy Silverlight DLLs to full .NET projects to perform elevated testing. Mock almost everything (from interfaces, virtual and abstract methods and properties to sealed classes, non-virtual methods and properties, static classes, methods and properties, etc.) right within the Silverlight project.
SharePoint Mocking?Microsoft SharePoint is a browser based web platform where you can set up Web sites to share and manage information and documents and publish reports in order to make it easier for people to work together.
OpenAccess Mocking?Telerik JustMock can be used in conjunction with Telerik OpenAccess to fake the data access layer to make it easier for you to test your target logic without worrying about its dependencies.
Entity Framework Mocking?With Microsoft Entity Framework you develop data access application by using a conceptual application model instead of relational storage schema.
Final Mocking?Final mocking is one of the advanced features supported in Telerik JustMock. It allows you to fake final method/property calls, set expectations and verify results using the AAA principle. Faking final or virtual method/property calls doesn't affect the way you write your tests, i.e. the same syntax is used for mocking both final and non-final calls.
Sealed Mocking?Sealed mocking is one of the advanced features supported in Telerik JustMock. It allows you to fake sealed classes and calls to their methods/properties, set expectations and verify results using the AAA principle. Faking sealed classes and calls to their methods/properties doesn't affect the way you write your tests, i.e. the same syntax is used for mocking non sealed classes.
Static Mocking?Static mocking is one of the advanced features supported in Telerik JustMock. It allows you to fake static method/property calls, set expectations and verify results using the AAA principle. Whether you mock static or instance calls there isn't much difference in the way your organize and write your tests.
Partial Mocking?Partial mocks allow you to mock some of the methods of a class while keeping the rest intact. Thus, you keep your original object, not a mock object, and you are still able to write your test methods in isolation. Partial mocking can be performed on both static and instance calls.
MsCorlib Mocking?Telerik JustMock enables you to mock methods from the .NET Framework, i.e. from MsCorlib. By adding some additional lines during your test class initialization you can easily mock even methods from MsCorlib.
Mocking Non-public Members and Types?In elevated mode, you can use Telerik JustMock to mock non-public members and types. That is useful when you want to isolate calls to non-public members.
Mocking LINQ Queries?With JustMock you can mock LINQ queries with custom select.
Threadpool Mocking?Threadpool mocking is one of the advanced features supported in Telerik JustMock. It allows you to access mocked objects inside another thread and work with them as expected.
Extension Methods Mocking?Extension Methods mocking is one of the advanced features supported in Telerik JustMock. By using it you can easily assert expectations related to extension methods in your tests.
Private Accessor?The Telerik JustMock PrivateAccessor allows you to call non-public members of the tested code right in your unit tests.

Feedback Portal

JustMock Lite is constantly improved through customer interaction and feedback. If you want to suggest a new feature or vote for a popular one, please visit our Feedback Portal.


Extensive Documentation and Examples

JustMock Lite comes with extensive documentation and examples that will help you quickly get started with the framework. You can also browse our Resources page, where you will find FAQs, blog posts, videos, and additional learning resources related to unit testing and mocking.