Questions tagged as 'mock'

2
answers

What is the difference between mock & stub?

In which situations should be used? What's the difference between them?
asked by 13.10.2014 / 19:56
2
answers

Make decorator override of Python mock

I have a class TestCase where all the tests, except one, need to do the same patch of an object. I'm using Python Mock , and I did the following: @mock.patch('metodo_alvo', mock.Mock(return_value=1)) class Tests(TestCase): @mock.p...
asked by 08.01.2014 / 23:19
1
answer

What are the differences between mocks and fakes?

When we implement testing on a software, Mocks and Fakes are two techniques or approaches to isolate code being tested from the rest of the system. Without going into the subject: Mocks are like empty shells with predefined behaviors,...
asked by 02.02.2016 / 02:09
3
answers

How to simulate JSON responses?

I need something that simulates JSON responses for me. Some time ago I had seen a site that did the following: You pass parameters by a URL, eg ?nome=Wesley&idade=21 I got the call in the JSON object like this: { nome:"...
asked by 14.07.2014 / 19:22
2
answers

Mock of static method with Demoiselle and PowerMock / Mockito

I'm trying to mock a static method, but PowerMock requires the use of a specific Runner (PowerMockRunner) for mock static to work! And for Demoiselle to work you have to start Weld with DemoiselleRunner, but the JUnit API only accepts a singl...
asked by 11.02.2014 / 14:34
1
answer

Avoid removing the TestProvider from the Mock Location

I'm trying to mock location for use in another application, but that application is removing my TestProvider, making it impossible to mock the location. How can I prevent this other app from removing my TestProvider ? The code that the ot...
asked by 30.11.2015 / 18:16
1
answer

Error using Mock: Wanted but not invoked: Actually, there were zero interactions with this mock

I am making a list of exercises and I am in doubt about the following:    Exercise 3 - The verify method, from the org.mockito.Mockito.verify package, is   used to check the amount of times a method is invoked.   Add in the ATest class a test...
asked by 01.04.2018 / 05:23
0
answers

Mock a raw_input

I have the following functions with raw input, which should receive a list [x, y] def input_origem(): origem = raw_input("Entre com o valor de x: ") origem = eval(origem) return origem def input_saida(): destino = raw_input("E...
asked by 22.12.2016 / 00:26
2
answers

Check data according to the information ready

I would like to make this form check the following data by clicking "Confirm" and if any of them is correct it will go to the next page. MOCK: $scope.cliente = [{ nome: "nomeedit", senha: "senhaedit", email: "[email protected]
asked by 09.10.2015 / 17:10
1
answer

How to return the value according to the received parameter?

I needed to do mocking with DAO, but the method receives a worksheet object and according to the id attribute of the Worksheet needs to return a different value. How do I compare the worksheet ID correctly? I want to test the readMeta...
asked by 26.05.2015 / 20:42