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
0
votes
1answer
103 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. ...
3
votes
4answers
298 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 ...
1
vote
1answer
262 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 ...
0
votes
0answers
650 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 ...
1
vote
2answers
104 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 ...
0
votes
1answer
43 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 ...
2
votes
2answers
198 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 ...
1
vote
0answers
265 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 ...
3
votes
1answer
86 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 ...
3
votes
1answer
69 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 ...
3
votes
1answer
63 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 ...
3
votes
2answers
37 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....
2
votes
1answer
437 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 ...
3
votes
6answers
653 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 ...
0
votes
1answer
36 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 ...
2
votes
2answers
164 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 ...
2
votes
0answers
381 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....
0
votes
2answers
325 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 ...
0
votes
1answer
50 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: ...
1
vote
1answer
56 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 ...
4
votes
2answers
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 ...
2
votes
2answers
12k 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 ...
7
votes
1answer
5k 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/...
0
votes
1answer
363 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....
0
votes
1answer
175 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 ...
11
votes
3answers
8k views

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

I have been reading alot 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 ...
5
votes
2answers
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 ...
0
votes
2answers
737 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
0
votes
1answer
68 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 ...
4
votes
7answers
2k 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.