Top "Spy" questions

A spy is XUnit pattern where you replace the original implementation with a test double to capture the calls on the object.

Mockito - @Spy vs @Mock

Mockito - I understand a spy calls the real methods on an object, while a mock calls methods on the …

java unit-testing mocking mockito spy
Spying on a constructor using Jasmine

I am using Jasmine to test if certain objects are created and methods are called on them. I have a …

javascript jasmine spy
How to change return value of jasmine spy?

I'm using Jasmine to create a spy like so: beforeEach(inject(function ($injector) { $rootScope = $injector.get('$rootScope'); $state = $injector.…

angularjs jasmine spy
Difference between Mock / Stub / Spy in Spock test framework

I don't understand the difference between Mock, Stub, and Spy in Spock testing and the tutorials I have been looking …

testing mocking spock stub spy
Tracking email with PHP and image

I have seen the service like spypig.com placing a small image in the email and tracking when it is …

php email geolocation tracking spy
mockito : how to unmock a method?

I have a JUnit class with different methods to perform different tests. I use Mockito to create a spy on …

java testing mockito spy
mockito better expected exception test using spy

How can I make the 3rd test to check for the existence of cause1 in the message of the exception? …

java mockito junit4 hamcrest spy
Mockito Spy - stub before calling the constructor

I'm trying to spy on an Object and I want to stub a method that is called by the constructor …

java unit-testing mocking mockito spy
Jasmine - Spying on a method call within a constructor

I want to test whether the following method is called with in my Javascript object constructor. From what I have …

javascript testing jasmine spy
How to spy on a default exported function with Jest?

Suppose I have a simple file exporting a default function: // UniqueIdGenerator.js const uniqueIdGenerator = () => Math.random().toString(36).substring(2, 8); export …

reactjs unit-testing mocking jestjs spy