Mocking Framework

from Wikipedia, the free encyclopedia

In software development, so-called mock objects are often used in module tests to isolate a component during the test run. A mocking framework can be used so that a dummy implementation does not have to be written in addition to the real implementation . This simplifies the task of simulating ("mocking") certain elements that are required for the test but which should not be tested themselves.

functionality

  • Record: The mocking framework records the behavior to be delivered.
  • Replay: The mocking framework plays the behavior in the test run.
  • Verify: After the test, the mocking framework checks whether the recorded behavior corresponded to the behavior in the test.

Beyond testing

A mocking framework can describe in great detail how a software module should work from the inside. This makes tests ideal for defining specifications. The advantage here is that code cannot (incorrectly) be interpreted, whereas a specification expressed in words leaves room for interpretation.

Mocking frameworks (selection)

JavaScript

  • Sinon.JS
  • jQuery Mockjax

C # / .NET

  • Rhino mocks
  • moq
  • NSubstitutes
  • FakeItEasy
  • Simple mocking
  • Microsoft fakes

C.

  • cmocka
  • cmockery

C ++

  • Google Test (formerly Google C ++ Mocking Framework)
  • Hippomocks

Java

Ruby

  • rr
  • RSpec Spies

python

  • Mock
  • pymox
  • dingus

ABAP

  • mockA

Delphi

  • Delphi mocks

Web links

Individual evidence

  1. Sinon.JS homepage. In: sinonjs.org. Retrieved December 20, 2012 .
  2. jQuery Mockjax. In: github.com/jakerella/jquery-mockjax. Retrieved July 8, 2015 .
  3. ^ Rhino Mocks homepage. In: hibernatingrhinos.com. Retrieved December 20, 2012 .
  4. moq on GitHub. In: github.com. Retrieved September 25, 2014 .
  5. NSubstitute on Github. In: github.com. Retrieved December 20, 2012 .
  6. The easy mocking library for .NET. Contribute to FakeItEasy / FakeItEasy development by creating an account on GitHub. FakeItEasy, December 13, 2019, accessed December 13, 2019 .
  7. Simple mocking on Codeplex. In: codeplex.com. Retrieved April 14, 2014 .
  8. MSDN: Isolating Code Under Test with Microsoft Fakes. Microsoft, accessed November 16, 2016 .
  9. unit testing framework for C with support for mock objects. Retrieved October 1, 2014 .
  10. ^ A lightweight library to simplify and generalize the process of writing unit tests for C applications. Retrieved October 1, 2014 .
  11. Google test on GitHub. In: github.com. Retrieved December 15, 2018 .
  12. Google C ++ Mocking Framework on GitHub. In: github.com. Retrieved January 8, 2016 .
  13. Hippomocks, C ++ Mocking Framework. Retrieved November 11, 2014 .
  14. mockito on Github. In: github.com. Retrieved December 20, 2012 .
  15. jmockit on github.io. In: github.io. Retrieved July 18, 2014 .
  16. Easymock homepage. (No longer available online.) In: easymock.org. Archived from the original on August 7, 2019 ; accessed on December 20, 2012 . Info: The archive link was inserted automatically and has not yet been checked. Please check the original and archive link according to the instructions and then remove this notice. @1@ 2Template: Webachiv / IABot / www.easymock.org
  17. PowerMock on Google Code. In: code.google.com. Retrieved December 20, 2012 .
  18. rr on Github. In: github.com. Retrieved December 20, 2012 .
  19. RSpec-Spies on Github. In: github.com. Retrieved December 20, 2012 .
  20. Mock homepage. In: voidspace.org.uk. Retrieved December 20, 2012 .
  21. pymox on Google Code. In: code.google.com. Retrieved December 20, 2012 .
  22. dingus on phyton.org. In: python.org. Retrieved December 20, 2012 .
  23. mockA homepage. In: github.com. Retrieved January 12, 2014 .
  24. ^ Delphi-Mocks homepage. In: github.com. Retrieved October 26, 2019 .