Questions tagged [mock]

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.

Filter by
Sorted by
Tagged with
-1 votes
1 answer
186 views

mocking tcp communication

I'm working on a couple of projects right now that could really use some mocking of third party services for our integration and performance tests. Normally, I would use WireMock-Net to spin up a ...
Lyndon Vrooman's user avatar
0 votes
0 answers
248 views

How to test RobotFramework test library using mock objects

I have created a RobotFramework test library in Python. It internally utilizes paramiko and paramiko-expect packages to connect to various *nix hosts and execute Unix commands. I have been reading ...
Amit Tendulkar's user avatar
0 votes
1 answer
243 views

Cucumber + Junit + Extend Test Steps (use IDs in next step)

Details: We currently use Mockito/ Wiremock (in different teams), Junit and Cucumber in our test procedure. And test cases are functional, but we want to extend them with regard to post procedures. ...
Mornon's user avatar
  • 1,107
3 votes
4 answers
903 views

How to spoof a third party API

Our application does calls to a third party API for completing a few tasks. This endpoint has an issue in the test environment, and management has asked us to mock this environment so when the app or ...
PDHide's user avatar
  • 11k
1 vote
1 answer
535 views

Mock test automation with Wiremock + Xray + Jenkins possible?

Task Workflow, which links Wiremock + Postman + Jira +Xray + Jenkins in such a way that automatic test procedures can be carried out, which then return reports to Xray. Details Currently we use the ...
Mornon's user avatar
  • 1,107
0 votes
0 answers
1k views

How can I mock location.pathname in reactjs

I tried all the possibilities to mock location.pathname This is my code if(typeof location !== undefined) { this.setParentPath(location.pathname); } This is one of the possibility I used to cover ...
Prakhar Khandelwal's user avatar
1 vote
2 answers
273 views

Best way to architect test development in Python so that tests can be run either with a mock or without a mock?

I'm starting a fresh python project and I want to write unit and integration tests with mocking and stubbing. However, I would like to run these tests during the build-pipeline against actual services ...
rrlamichhane's user avatar
0 votes
1 answer
49 views

Is there any mocking framework available for blackbox testing of windows and mac apps?

We test a bunch of applications on windows, mac and mobile platforms. We use a tool called TPlan robot for our UI automation testing of those apps. Our testing is blackbox testing so there is no way ...
Sarat's user avatar
  • 1
2 votes
2 answers
218 views

Best strategy to test automatically a web application

I have an application that consist of a web server in Java EE (EJBs and JAX-RS RESTful services) and a client module in Angular that runs in a browser. The components that I can unit test ...
ps0604's user avatar
  • 131
1 vote
0 answers
466 views

My mock test for Github client contains messy stubbing and it feels like I'm testing implementation details

I wrote a GithubClient class which is basically a wrapper for Ruby's Octokit library. It contains one public method aside from the constructor, called push, which basically creates commit in the ...
Eric's user avatar
  • 205
3 votes
1 answer
114 views

What should be unit tested in an API client?

I've been reading about unit testing day in, day out for a few days and the more I did, the more frustrated I became. The System Under Test is essentially a client calling external APIs that take XML ...
Eric's user avatar
  • 205
3 votes
1 answer
74 views

High-level help desired in forming a plan of attack for testing of background "cleanup" tasks

I have written and continue to maintain a fairly complex back-end service written in Java that scrapes arbitrary web sites, involves long-running processing jobs, and includes background tasks that ...
CryptoFool's user avatar
3 votes
1 answer
67 views

How to properly test an indoor map, when you're not on the site itself?

We have a indoor map app. The app is powered by both Google and Bluetooth GPS devices. How can we mock locations when using this kind of technology? What are the strategies that can be used to test ...
Marj's user avatar
  • 1,357
3 votes
2 answers
40 views

How to fake executable is missing?

related: https://github.com/fish-shell/fish-shell/issues/5444 I'm in the process of testing pure theme for fish. I want to test the following conditional branch from our __pure_prompt_first_line....
Édouard Lopez's user avatar
3 votes
1 answer
500 views

How to properly mock dependencies

My code is organized as several independent classes. Each dependency is injected by a setter, so in the end I create instances of classes B and C, set their parameters and inject them to class A. Now ...
Samuel's user avatar
  • 131
3 votes
6 answers
984 views

Advice on API Mocking Tools

I was interested in hearing people's experiences of using mocking, specifically for API testing. Whilst I’m (fairly!) well versed in automation techniques now, I haven’t yet used this approach but ...
Andy Tilston's user avatar
0 votes
1 answer
41 views

How to test a class that wraps methods connect to a remote database

I wrote a class creating connection to a remote database, query and do some more actions on that. Which is the best way/ strategy to test that kind of class? I tried to mock third party functions ...
achilles's user avatar
  • 101
2 votes
2 answers
186 views

How can I mock a c# restful webservice and test it using java?

I suppose this is more like two questions. Considering i wanted to do some automated testing of a restful web service that is written in c#. How can I using java and something like rest-assured test ...
symon's user avatar
  • 934
2 votes
0 answers
449 views

How to check children method has been called in jasmine test cases?

We use spyOn(this,"_new") to track a function call in jasmine. I need to check the children method call in jasmine. My code sample is given below, Sample code: function perform(option) { this....
Thiru Arasu's user avatar
0 votes
2 answers
404 views

How to save and share the data across multiple requests under same project in SoapUI?

I am new to the SOAPUI and have created few rest mock services in it. Now I have two separate rest mock services which do not interact with each other but are under the same project in SoapUI. The ...
Nikunj Aggarwal's user avatar
0 votes
1 answer
59 views

TypeMock trying to mock a random method?

I've hit an issue that has stumped me. I have Specflow tests that run perfectly fine on my local machine, but fail when run in the build. The error message I get is: System.MissingMethodException: ...
Cascade's user avatar
  • 11
1 vote
1 answer
58 views

How to avoid hidden bugs caused by test doubles?

I just got the Mockito framework for Java to try out mocking with JUnit. Trying it brought me to a basic question that I am sure is obvious but I have had trouble finding any answer for, probably ...
Hello's user avatar
  • 11
5 votes
2 answers
1k views

Android App api testing with mock

Currently, I ran into a situation where we are having constant Backend/API issues and because of the same, I can't continue with the testing. I was wondering if it is somehow possible to use a server ...
Madis Kangro's user avatar
4 votes
2 answers
14k views

Mocking HTTP reponses in Selenium Web Driver using Python

I am currently experimenting with the Python version of Selenium Web Driver. Using the driver has been straight forward so far but I have been struggling recently with the issue of mocking HTTP ...
Wolf_Brigade's user avatar
7 votes
1 answer
6k views

What Is the Best Way To Mock Browser Time and Time Zone in Selenium? [closed]

I like to run Webdriver tests with altered time and time zone. I see two approaches ahead: 1) Using a mocking library like SinonJS or TimeShift.js. 2) Using system libraries like libfaketime/...
John Slathon's user avatar
0 votes
1 answer
649 views

Testing Verify Method Call Without Argument In Test Class

I have a class which takes a message with payload String. The payload is then split and used to create an Entity which is passed to DAOInterface to persist. How can you test the call daoInterface....
zak's user avatar
  • 1
0 votes
1 answer
182 views

Android / Java Unit-Testing Clarification

While looking up for unit testing for Android applications, I came across a lot of voices over how it is difficult to test-unit an Android app. For example: Dependency issue - why is this a problem ...
Unheilig's user avatar
  • 101
12 votes
3 answers
9k views

To mock or not to mock with 'Automated Acceptance Tests'

I have been reading a lot about automated acceptance testing. However, I have not found any information about how to manage external dependencies. Let's say you have a web application that acts like a ...
Martin's user avatar
  • 241
5 votes
2 answers
2k views

Mocking IVR system

I am new to automation testing and was looking for guidance on how I can mock or create a simulator for a IVR ( automated call system ). We have an application, which sends some user data to a third ...
Parth's user avatar
  • 51
0 votes
2 answers
751 views

Recent comparisons of Java mocking frameworks?

I'm trying to find recent comparisons of Java mocking frameworks but all of the ones I've seen are quite old. Can anyone point me to something relatively recent? Thanks
WXB13's user avatar
  • 101
0 votes
1 answer
78 views

Mocking for MXUnit

I'm fairly new to Coldfusion; at my new position, we're using MXUnit for unit testing our service library, but so far we're not mocking out the database (so we're testing against live data). I want to ...
Yamikuronue's user avatar
  • 3,372
5 votes
7 answers
3k views

Where can I find ISTQB Foundation mock exams with reliable answers?

Where can I find ISTQB mock exams with reliable answers? I have heard that there are a lot of sites with mock exams but they told me to be careful because some of their answers are not correct.
asmundur's user avatar
  • 159