Questions tagged [unit-testing]
Unit testing is a method by which individual units of source code are tested to determine if they are fit for use.
38
questions with no upvoted or accepted answers
5
votes
1
answer
12k
views
Should I mock ObjectMapper in my unit tests?
I have different services in a spring application that have a dependency on Jackson ObjectMapper, the unit tests rely on @InjectMocks to inject all the various dependencies to the class that is under ...
4
votes
0
answers
56
views
Decoupling redux reducer tests from state shape
Recently I have been refactoring state shape in a fairly large redux application, and I have found that one of the obstacles to doing to is that the tests for my reducers clearly have a lot of "...
2
votes
2
answers
537
views
Integration Testing Stripe Payments - stripe-mock or Stripe's test mode?
I'm building an automated test suite to integration/feature test my organization's Stripe implementation within a GitLab CI pipeline. We're running Laravel 8 and using phpunit for testing.
Within this ...
2
votes
0
answers
1k
views
Unit testing C++ in XCode
I'm working on a plugin for some drafting software. The plugin takes the form of a dynamically loaded mach-o bundle.
The software vendor provides a template plugin in the form of an XCode project.
...
1
vote
0
answers
142
views
How to improve maintainability and testability of a service by refactoring it into a functional style
A customer of ours has a rather large (500+ LOC) service as central part of the project. Written in C# and consisting of rather clunky large imperative style functions, I was asked to improve the test ...
1
vote
2
answers
752
views
Entity Framework and Domain Driven Design Testability
I'm using a DDD approach for the Domain classes. Although, I have a problem on my design, that I'm handling it now but didn't have a good idea to over tackle it.
My Architecture is the follow one:
- ...
1
vote
0
answers
620
views
How to run the Unit Test on Master branch using hook before merging the incoming changes of other branches
We have project which have more than 500 unit test and run for hours through Jenkins CI pipeline. In case there is failure of single UNIT test we need to kick off the build job again. I want to run ...
1
vote
0
answers
48
views
Integrating Testing with Model Checking
So with Model Checking you have a specification and the model checker automatically goes through your program's states and checks if it matches the specification. What I don't understand is where ...
1
vote
0
answers
53
views
Node JS Tape Unit Testing : All cases inside one function for a method
I am using tape for unit testing in Node JS. I wanted to ask one thing about better coding while writing unit testing.
When using different inputs to a single method, is it a better idea to use all ...
1
vote
0
answers
111
views
writing unit tests for 3rd party applications
Does anyone have any comments on how to write unit tests for 3rd party applications like kamailio...that allow you to write "configuration scripts"?
https://www.kamailio.org/wiki/cookbooks/4.0.x/core/...
1
vote
0
answers
876
views
Integration test with seed data or programmatically generated objects?
We're having a bit of a discussion in the office about how to implement good integration tests.
Example:
Account Creation
1. Create User
2. Add Role
One case we test is, if there is already a user ...
1
vote
0
answers
171
views
How to get verification that you've implemented all your API in a static library?
I just learned that static library building skips the linking stage, which explains why my build process succeeds all the time when it's possible I actually haven't implemented a function in my header....
1
vote
0
answers
61
views
Dealing with stubbed external dependency
In sut I should I have two kinds of dependencies to be stubbed: 3rd party dependencies (mongodb & co) and own dependencies:
var async = require('async'), // This dependency should not be stubbed
...
1
vote
0
answers
795
views
ASP.Net MVC - Implementing a Test Environment
I would like to implement some sort of test environment for ASP.Net projects. I am trying to implement this as an alternative to mocking the entity framework.
Here is what I am trying to achieve :
...
1
vote
0
answers
7k
views
How to verify a method is only called once, with specific arguments (using RhinoMocks)
I'm just starting to use RhinoMocks. Now I'm wondering what test cases I should write. I want to assert that a method is only being called once, with specific arguments.
Lets start with my interfaces....
1
vote
0
answers
179
views
Unit Tests for Database Abstraction Layer
I previously asked this question about creating an algorithm for joining records from multiple databases, and since then, I have built a rudimentary version of it (which doesn't allow for inter ...
0
votes
0
answers
50
views
Is using @Transactional together with @Test annotation on the same test method a good practice?
In my current Java project, there is such style of integration test:
@Test
@Transactional
public void testBusinessTransaction() throws Exception {
//...complicate set up code and execution code
...
0
votes
0
answers
64
views
Unit testing with dependency on Word COM objects: Wrappers & interfaces vs document as an embedded resource
We are developing Word Addins that interact with elements in Word documents.
To make it testable, my approach has been to use interfaces and wrappers for UI elements, and then provide mock alternative ...
0
votes
1
answer
202
views
Should mocks used in unit tests represent entireties or subsets?
I was working on a unit test that has a mock object looking something like:
public class TestMock
{
static {
Doodad a = new Doodad(0);
Doodad b = new Doodad(1);
Doodad c = ...
0
votes
0
answers
130
views
Mock/Reality consistency : unit test or integration test?
In a golang project, I have mocked external services. But in order to check that mocked services has the same behaviour as real services, I have done some common testing on the interface with both ...
0
votes
0
answers
42
views
Using a bulletin board to support Separation Of Concerns
Context:
I'm working on an embedded system with many small functional modules. The business logic within each module is made as simple as possible, but those modules generally need to gather bits of ...
0
votes
0
answers
46
views
Logically equivalent conditionals, same test, but different condition coverage (google test)
Title pretty much says it. I ran into trouble getting condition coverage of a logical statement and found that the order in which the statement is written (rather than order of operations) results in ...
0
votes
0
answers
23
views
Should I do migration testing if the new library needs a different testing suite?
I'm using a pretty old library to make server requests which is not properly tested and it not really matching nowadays requirements, so the plan is to migrate to a new one over the next release. So ...
0
votes
0
answers
1k
views
Mocking delegate constructors
I am new to Unit Testing in C++. I am supposed to write a Unit test for my code and I am using Google Mock for the same. I have gone through their turtle example.
But I am still confused as to how to ...
0
votes
0
answers
128
views
Abstract Web API from validation and configuration management in embedded system
Im working with embedded Linux for a router. There is a web GUI for the user to configure router options. When user fill a web form this is submitted to a web server function that is responsible of ...
0
votes
0
answers
195
views
How to handle karma/bower in a Symfony Bundle on github?
i am working on a Symfony Bundle that uses angular among other javascript deps.
Now i want to unit-test my javascript code and i want to ship those tests as well.
My initial idea was to add bower....
0
votes
0
answers
128
views
Unit Testing in iOS -- Should I split out my Data Model into its own class?
I'm attempting to try out using unit test in for the first time in new iOS activity for work. I love the idea of unit testing, but always find the specifics to be... messy.
I get the general ...
-1
votes
1
answer
51
views
In the following example, would the public properties be considered Dependencies/Collaborators
In the code sample below. Would UserId, Email, and UserType be considered "dependencies" with respect to the ChangeEmail method? would they be considered "collaborators"? Is it a ...
-1
votes
1
answer
503
views
How to create input data for unit tests for an API client?
I am building the initial set of unit tests for my team's legacy API client system. We have been writing integration tests, but have no unit tests.
It's a Sinatra server that accepts requests from our ...
-1
votes
1
answer
256
views
How to do test-driven front end development?
I'm trying to rapidly develop my frontend, but every time I change my code I find myself refreshing my browser and running some macro to test whether the changes in my code solved the problem.
I ...
-1
votes
1
answer
51
views
Non regression test for small set of data data driven from database, how to handle future data
While writing this question I found out that I'm faced with 2 problems: a testing one and a production one but I hope that resolving the situation can solve both issues.
Now the question:
I have a ...
-1
votes
1
answer
134
views
How to test and what kinds of test to write for Request Handlers that use Repository layer?
Consider class below:
class FillTestBySerialHandler
{
/**
*
* @var FillTestBySerialRepository
*/
private $fillTestBySerialRepository;
function __construct(...
-1
votes
2
answers
77
views
How to test functionality that only creates input to a large middle-ware dependency
I am a new lead developer that has recently started at a new company, I have been assigned to a project that is trying to consolidate functionality from lots of different applications already in ...
-1
votes
1
answer
87
views
writing a database-centric function with test-first
I'm trying to think about the best method to write a function whose primary operation is going to be doing crud on the database. Here's what the overall structure of the function (sans any ...
-1
votes
1
answer
2k
views
Test Cases in an Interview Setting
In the first cracking the coding interview video Ms. McDowell talks about candidates that begin by writing test cases in whiteboard interviews. How would one go about this?
For example, the ...
-1
votes
1
answer
59
views
Testing Application Helper that Depends on Controller
I am working on practicing TDD/BDD/ATDD and I am working on a rails application.
I created a helper method that depends conditionally on the type of controller being tested.
module ApplicationHelper
...
-3
votes
5
answers
1k
views
How to make a test process for unit testing?
I recently joined a team of developers that has been working on a software project for several years. I have been asked to create a unit testing test process to improve their output and suggest new ...
-4
votes
1
answer
1k
views
What are the benefits of using Jasmine Framework on existing applications?
I got one project which contains JavaScript code. No unit tests were written for JavaScript code.
So it is feasible or beneficial to write unit test cases using Jasmine Framework for code?
What are ...