Skip to main content

Questions tagged [mocking]

Mocking and faking are ways to isolate code or components to ensure that unit tests run against the testable unit of code only without actually utilizing other components or dependencies of an application. Mocking differs from faking in that a mock can be inspected to assert the results of a test.

0 votes
4 answers
233 views

Lets say I have an API with two functions: CreateNewMachine(CreateMachineCommand createMachine); EditExistingMachine(EditMachineCommand editMachine); The internal logic of both functions should be ...
David Mason's user avatar
-3 votes
1 answer
145 views

If I want to implement a connection from my software to an API, which is documented but not accessible yet, what is a common way to imitate the API until it is available? My first idea was to mock the ...
harrow's user avatar
  • 111
3 votes
2 answers
688 views

I'm creating tests for our .Net 8 API. We use MySql for data storage and CQRS pattern for queries. In my personal opinion, I shouldn't use the real database for testing, because you will use an ...
Diego Perez's user avatar
1 vote
1 answer
218 views

Articles such as this point out some of the pitfalls of manually instantiating dependencies in UTs, while showing some of the benefits of doing it, instead, with the .NET's dependency container by use ...
Veverke's user avatar
  • 541
-1 votes
1 answer
747 views

Typically, when writing unit tests I tend to need to stub out collaborators and also mock some behavior in one or more of the collaborating objects. Say if I am testing a Service that is using a Dao, ...
oligofren's user avatar
  • 107
1 vote
1 answer
172 views

My team and I are beginning to mock our API responses in our iOS app so we don't have to worry about our backend being up when testing. I have conditional compilation directives based on the ...
Derek's user avatar
  • 121
1 vote
3 answers
189 views

I have lots of code like the following. An "Entity" type that has some numerical properties. To be able to reuse the arithmetic I write the arithmetic functions against an interface. I use ...
Dave Cousineau's user avatar
-1 votes
3 answers
138 views

About tests: I have the following view on nomenclature: Unit tests are the kind of testes where you have a function ExtractBacon, where there is a function with an entry parameter Pig and a return of ...
sergiol's user avatar
  • 157

15 30 50 per page
1
2 3 4 5
14