# Welcome to Telerik JustMock

Telerik JustMock is an easy to use mocking tool designed to help you create better unit tests, faster than ever. JustMock makes it easier for you to create mock objects and set expectations independently of external dependencies like databases, web service calls, or proprietary code.

JustMock follows the [Arrange/Act/Assert (AAA)](https://www.telerik.com/products/justmock/documentation/basic-usage/arrange-act-assert) pattern. You **arrange** mock behavior with `Mock.Arrange`, **act** by calling your production code, and **assert** results with `Mock.Assert` or your preferred assertion library. The same pattern works whether you mock an interface, a virtual method, or a static type.

To read more please visit the [Telerik JustMock](https://www.telerik.com/products/mocking.aspx) product overview page.

JustMock is available in two editions:

* **JustMock Lite** (free) — no profiler required. Mocks interfaces, virtual members, and abstract members.
* **JustMock** (commercial) — requires the JustMock profiler. Adds mocking of static classes and methods, sealed classes, non-virtual members, non-public members, and `mscorlib` types such as `DateTime` and `File`.

For a full feature comparison, see [Commercial vs Free Version](https://www.telerik.com/products/justmock/documentation/licensing/commercial-vs-free-version).

## What Is Mocking and Why Do I Need It?

[Mocking](https://en.wikipedia.org/wiki/Mock_object) is a concept in unit testing where real objects are substituted with fake objects that imitate the behavior of the real ones. Mocking is done so that a test can focus on the code being tested and not on the behavior or state of external dependencies.

For example, if you have a data repository class that runs business logic and then saves information to a database, you want your unit test to focus on the business logic and not on the database. Mocking the “save” calls to your database ensures your tests run quickly and do not depend on the availability or state of your database. When you’re ready to make sure the “save” calls are working, then you’re moving on to *integration testing*. Unit tests should not cross system boundaries, but integration tests are allowed to cross boundaries and make sure everything works together (your code, your database, your web services, etc.).

## What Can Be Mocked?

**JustMock** creates mock objects automatically at runtime — no hand-written fakes to maintain as your production code changes. The edition you use determines what you can mock:

| Target                                        | JustMock Lite (free) | JustMock commercial   |
| --------------------------------------------- | -------------------- | --------------------- |
| Interfaces                                    | ✔                    | ✔                     |
| Abstract and virtual members                  | ✔                    | ✔                     |
| LINQ queries                                  | ✔                    | ✔                     |
| Sealed classes                                | ✘                    | ✔ (profiler required) |
| Non-virtual methods and properties            | ✘                    | ✔ (profiler required) |
| Static classes, methods, and properties       | ✘                    | ✔ (profiler required) |
| Non-public members and types                  | ✘                    | ✔ (profiler required) |
| `mscorlib` members (`DateTime`, `File`, etc.) | ✘                    | ✔ (profiler required) |
| DLL imports                                   | ✘                    | ✔ (profiler required) |

None of these require changes to your production code.

### Final and Static Mocking

Unlike other mocking frameworks, JustMock lets you mock:

* **Sealed classes** — call methods of sealed classes, even with internal constructors.
* **Static classes, methods, and properties** — arrange and verify static method and property calls.
* **Non-virtual (final) methods and properties** — assert non-virtual methods, overloads, `out` parameters, and `ref` parameters.

## Features At A Glance

* **Test objects and behaviors independently** - fake any dependencies like databases, web service calls, proprietary code
* **Mock everything**
  * interfaces
  * virtual and abstract methods and properties
  * LINQ queries
  * sealed classes
  * static classes, methods, and properties
  * non-virtual methods and properties
  * non-public members and types
  * mscorlib members
  * DLL imports
* **Clean Arrange/Act/Assert syntax** - keep your unit tests clean and readable
* **Strongly typed fluent interface** - no magic strings, compile time checks, refactoring support
* **Loose mocks, Partial mocking, Recursive/nested mocking, Sequential mocking**
* **Fast and lightweight** - custom dynamic proxy library meets mocking needs only
* **Support for Visual Studio** - JustMock supports Visual Studio 2019 and later
* **Support of Microsoft SharePoint and Microsoft Entity Framework mocking**
* **Support for CI/CD, build tools, code coverage tools, profilers, unit testing add-ins and other**
  * Integration with Azure Pipelines. [Read how to integrate JustMock with Azure Pipelines](https://www.telerik.com/products/justmock/documentation/integration/continuous-integration/azure-devops)
  * [MSBuild](https://msdn.microsoft.com/en-us/library/wea2sca5\(VS.90\).aspx) - integrate JustMock with an MSBuild build task. [ Read how to integrate JustMock with MSBuild ](https://www.telerik.com/products/justmock/documentation/integration/msbuild-tasks).
  * [Jenkins CI](https://jenkins-ci.org/) - integrate JustMock along in Jenkins build. [ Read how to integrate JustMock with Jenkins CI ](https://www.telerik.com/products/justmock/documentation/integration/continuous-integration/jenkins-ci).
  * [TeamCity](https://www.jetbrains.com/teamcity/) - integrate JustMock in TeamCity build. [ Read how to integrate JustMock with TeamCity ](https://www.telerik.com/products/justmock/documentation/integration/continuous-integration/teamcity).
  * [NCover](https://www.ncover.com/) - JustMock supports NCover 1.3.3, 1.5.8 and 3.4.6.
  * [JetBrains dotCover](https://www.jetbrains.com/dotcover/) - JustMock supports JetBrains dotCover version 3.1 and above.
  * [JetBrains dotTrace](https://www.jetbrains.com/profiler/) - JustMock supports JetBrains dotTrace version 3.1 and above.
  * [PostSharp](http://www.sharpcrafters.com/) - for version 2.1.2.8 and above

## Getting Started with Telerik JustMock

To learn how to install and work with Telerik JustMock, visit the following resources:

* [System Requirements](https://www.telerik.com/products/justmock/documentation/getting-started/system-requirements)
* Installation:
  * [Windows](https://www.telerik.com/products/justmock/documentation/getting-started/installation/instructions-windows)
  * [macOS](https://www.telerik.com/products/justmock/documentation/getting-started/installation/instructions-macos)
  * [Ubuntu](https://www.telerik.com/products/justmock/documentation/getting-started/installation/instructions-ubuntu)
  * [Using NuGet package](https://www.telerik.com/products/justmock/documentation/getting-started/installation/instructions-nuget-package)
  * [Using Telerik Control Panel](https://www.telerik.com/products/justmock/documentation/getting-started/installation/instructions-control-panel)
* [Add Telerik JustMock to Your Test Project](https://www.telerik.com/products/justmock/documentation/getting-started/configuration/using-telerik-justmock-in-your-test-project)
* [JustMock API Basics](https://www.telerik.com/products/justmock/documentation/getting-started/api-basics/basics)

## Support Options

For any issues you might encounter while working with Telerik JustMock, use any of the available support channels:

* License holders and active trialists can take advantage of our outstanding customer support delivered by the developers building the library. To submit a support ticket, use the [dedicated support system](https://www.telerik.com/account/support-tickets?pid=743).
* Our [forums](https://www.telerik.com/forums/justmock) are part of the free support you can get from the community and from the team on all kinds of general issues.
* Our [feedback portal](https://feedback.telerik.com/justmock) provides information on the features/bugs in discussion and also the planned ones for release.

## Learning Resources

* [Learning Resources](https://www.telerik.com/support/justmock)

## Next Steps

* [System Requirements](https://www.telerik.com/products/justmock/documentation/getting-started/system-requirements)

## See Also

* [Visual Studio Extension](https://www.telerik.com/products/justmock/documentation/getting-started/configuration/visual-studio-extension)
* [Commercial vs Free Version](https://www.telerik.com/products/justmock/documentation/licensing/commercial-vs-free-version)
