About 9,760,000 results
Open links in new tab
  1. unit testing - What is Mocking? - Stack Overflow

    Apr 19, 2010 · What is Mocking? .Mocking is primarily used in unit testing. An object under test may have dependencies on other (complex) objects. To isolate the behaviour of the object you …

  2. What's the difference between faking, mocking, and stubbing?

    Dec 6, 2008 · For example, mocking network requests allows you to test positive cases and fault cases without the unpredictable nature of actual network calls. Mocks will often include some …

  3. mocking - Swagger/OpenAPI mock server - Stack Overflow

    Feb 12, 2020 · Mocking is supported on both free and paid plans. To use the mock server, import your spec into SwaggerHub and enable "API Auto Mocking". Mock responses can be JSON, …

  4. unit testing - Mocking using Moq in c# - Stack Overflow

    Mar 23, 2017 · Classic example which demonstrates that if you cannot unit test a particular component, REFACTOR it! This is why I love what any mocking framework enforces you to do …

  5. What is the purpose of mock objects? - Stack Overflow

    Sep 1, 2010 · Also note that this is a pretty simplistic example and that mocking frameworks allow for some pretty sophisticated specifications of expected behavior from components to support …

  6. unit testing - When should I mock? - Stack Overflow

    Sep 1, 2008 · I have a basic understanding of mock and fake objects, but I'm not sure I have a feeling about when/where to use mocking - especially as it would apply to this scenario here.

  7. mocking - How can I mock the JavaScript 'window' object using …

    9 The window object in Jest is self-mocking One of the things unaddressed in other answers is a comment by the OP: Using Jest, I don't know how to mock the window. The window object is …

  8. c# - Mocking HttpClient in unit tests - Stack Overflow

    Apr 5, 2016 · I have some issues trying to wrap my code to be used in unit tests. The issues is this. I have the interface IHttpHandler: public interface IHttpHandler { HttpClient client { get; } } …

  9. Why are my mocked methods not called when executing a unit test?

    Oct 11, 2022 · Preface: This question and answer are intended as a canonical answer to the majority of questions that arise due to misuse of Mockito or misunderstanding how Mockito …

  10. Why is it so bad to mock classes? - Stack Overflow

    Jan 25, 2017 · 17 Mocking classes (in contrast to mocking interfaces) is bad because the mock still has a real class in the background, it is inherited from, and it is possible that real …