All Questions
330
questions
1
vote
2
answers
35
views
How do unit tests work in test-driven development?
I've been thinking a lot about unit tests today and I got a bit puzzled as to how exactly unit tests are created during the test-driven development (TDD) process. (To be clear, a unit test for me is ...
0
votes
0
answers
57
views
How to mock web3 method call
How would one mock this call to a ethereum smart contract using the web3 js library.
export const getERC20Balance = async (
web3Client: Web3,
tokenAddress: string,
walletAddress: string
) => {...
0
votes
1
answer
15
views
Should I add the nupkg dependencies of the Assembly of the SUT to the Test Project as well?
I'm relatively new to writing unit tests. I ran into this scenario while writing unit test cases in .NET 8,for azure functions.
Project 1 - ABC.Functions
Project 2 - ABC.Functions.Test
I have added ...
-1
votes
2
answers
47
views
Would it still TDD if I would plan and list (as comment) all test ahead?
Would it still count Tdd when I some kind of start planning before even writing test down? I mean create test files with commented test case names. In that way I could for example anticipate and ...
0
votes
1
answer
95
views
How to mock static method which will try to establish HttpsURLConnection and will return a connection Object of type HttpsURLConnection using Mockito
I'm new to java.
While working on a requirement Where I need to write test cases for a utility class, there exists lines as seen below :
HttpURLConnection con =null;
if (T.equalsIgnoreCase(...
1
vote
0
answers
100
views
How to implement Uncle Bob's ideia of zero parameters in this case?
I am trying to apply a principle I read on Uncle Bob's book "Clean Code", which states that the optimal amount of parameters for a method is zero. I found this is very hard to accomplish, ...
0
votes
2
answers
378
views
Error when reverse url with multiple arguments - Django
I'm writing a test for an url, problem is it fails when I try to pass multiple arguments, here is some code:
#test_urls.py
from django.test import SimpleTestCase
from django.urls import reverse, ...
0
votes
2
answers
53
views
How do Devs share relevant testing information with Devs-in-Test and QAs?
One of the problems our group is having is in regards to sharing relevant information between the Devs, Devs in Test and QAs.
How is this typically done in the industry?
For instance, our devs ...
5
votes
3
answers
521
views
TDD for an algorithm involving randomness
I would like to try out test-driven development, but the project I am working on involves a lot of randomness and I am very unsure about how I can test it. Here is a toy example of the kind of ...
-1
votes
1
answer
344
views
How to apply test-driven development for storing data on db?
Let us assume that the next feature that I have to develop is to store some data on a database. Following the TDD paradigm, I have to first write a failing test. It is not clear to me how I can ...
-1
votes
1
answer
584
views
Where do end-to-end or integration tests fit within a TDD worflow?
Everyone is familiar with the typical workflow of TDD: write a failing test, make the test pass by writing just enough code, refactor your code, and repeat. This is often captured with the coined &...
3
votes
2
answers
2k
views
Confusion about scope in Jest tests
Can someone explain simply what the practical difference is in how each of the following tests is executed:
Case 1
const variable = generateVariable();
test('generates the correct value', () => {
...
2
votes
2
answers
359
views
TDD on a client-server application
I’m having problem to grasp how to do TDD when building a client-server system.
The simple katas (Fizzbuzz etc) are easy to understand, but when my client needs to send the server a file using TCP ...
0
votes
1
answer
39
views
How to make this removeMiddle test pass when just return 1 value
I am trying to create a function to make this test pass
Here is my following code for my test cases:
var removeMiddle = require("./remove-middle");
test("Remove middle", function (...
0
votes
1
answer
22
views
Why does the matrix update the index for both the columns?
I am building a gameboard in JS for a battleship game and here's its current structure:
export default class Gameboard {
constructor(size) {
this.grid = this.#createMatrix(size);
}
#...