The Arrange/Act/Assert pattern is a more logical and clean approach to unit testing than the legacy Record/Replay. With AAA, you group yourtesting actions by function, making it clear what part of your test is involved in setup versus verification. The pattern can be applied to all unit testing, but it is especially useful when mocking is involved.
Record/Replayis an older pattern and it is similar to using GOTO statements in your unit tests. This makes the pattern more difficult to follow and clearly less ideal from a programming perspective. Therefore, JustMock is focused on supporting the AAA pattern.
Mock objects can be created and maintained manually, but this is a time consuming and ultimately unproductive approach. A tool likeJustMock allows you to focus on writing tests and forget about the mocking details. Mock objects are created automatically in memory when the tests run based on your simple configuration in the unit test. There are no “physical” mock objects that have to be maintained as your project changes.
JustMock goes even further and does not force you to distinguish between “mocks,” “fakes,” and “stubs.” With JustMock,you have a single, easy to use API for all of your mocking needs.
Mocking is a concept in Unit Testing where the dependencies in the software being tested are substituted with proxies that are programmed to act in a controlled manner. This prevents those dependencies from interfering with the results. Mocking is commonly used for removing dependencies like database or file system access, or calls to code that are out of scope for the unit being tested.
For a deeper discussion on the benefits of mocking, please refer to this blog post by Telerik Evangelist Phil Japikse.
It is possible to overuse mocking. The goal of mocking is to isolate the code you want to test from other components in the system. There are two rules of thumb that should be followed to ensure mocking is done properly:
Of course. In addition to comprehensive documentation online, when you download JustMock, you’ll find a demo project that shows you, through code, all of the various ways you can use JustMock.
You can also visit the JustMock forums, which are frequented by Telerik developers who make sure that no question is left unanswered and no issue goes unaddressed.
JustMock comes in two editions. JustMock Lite, the free edition, mocks interfaces events, exceptions, properties and behaviors but cannot perform elevated mocking. JustMock, the full edition, performs elevated mocking enabling you to mock framework classes (such as msCorlib), LINQ queries to static methods and sealed classes. Upgrading from JustMock Lite to JustMock the full edition, is easy and you can even continue to work with the same codebase.
Both editions benefit from three major releases a year, plus service packs and hotfixes when needed. For a full comparison, please check the comparison table on the JustMock Lite page.
Among the many features in JustMock, here are areas where Telerik provides unique value:
Copyright © 2016, Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks or appropriate markings.