All Questions
Tagged with testing unit-testing
6,647
questions
0
votes
1
answer
58
views
when() requires an argument, Mockito and BCrypt
I'm trying to make an unit test in a project, but i'm stuck at trying to mock the BCrypt.checkpw function, i've read that making a static mock requires a certain way to handle the test, i'm not ...
0
votes
0
answers
43
views
Testing frameworks and best practices for LLM testing
I am developing a GenAI-enabled matching solution where I send two lists of objects ith many features each to an LLM and ask to match them based on semantic similarity. I want to implement automated ...
0
votes
2
answers
25
views
How to mock and perform asserts in MessageBox
I'm making a desktop/on-premise application using C# .Net Windows Forms and I need to perform some tests on a class that interacts with the user through messages while carrying out some processes, and ...
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
2
answers
36
views
Compared to every other type of test, why are unit tests valued so highly? [closed]
I am struggling to understand why unit tests are valued so highly in the coding community. If I look at any other type of test (e.g. feature, integration, TIP), I think any of them carry infinitely ...
-1
votes
1
answer
14
views
Can't spyOn second & third call jest
I can't do spyOn on the second and third calls of a function in a test with jest
I tried to do it like this by following the documentation :
it("should succeed after retry on first attempt ...
0
votes
0
answers
27
views
How can I create a unit test for a memory dump without mocking?
In Javascript, I have these two functions:
const promiseMemoryDump = async (address1, address2, outputFile) => {
if (getPlatform() === 'linux') {
await promiseExec(`memdump -s ${address1} -...
0
votes
0
answers
19
views
How to test and to what extend should I write unit tests?
I am new to unit testing, and currently working on a new release of one of my packages to be testable.
Currently, I am struggling to see when and what to test. Take the following script for reference:
...
0
votes
0
answers
56
views
How to test navigation to page in MAUI?
I have a simple navigation service :
public class NavigationService(INavigation navigation) : INavigationService
{
public INavigation Navigation { get; } = navigation;
public void ...
0
votes
0
answers
28
views
writing test for the upload image and get image methods in spring boot
I am working on a Spring Boot project. One of the features of the project is the ability to upload image and get image using APIs.
this is my UserServiceImpl:
package com.example.firsttask.service....
-1
votes
1
answer
129
views
How do you test react-aria-components for the custom props you passed in?
The components render fine on a live local server and everythign works fine. But I can't figure out how to test the components for the react-aria-library. I know they are already tested by the ...
0
votes
1
answer
59
views
pytest fixtures in nested Classes
I have written the following testcase using pytest.
import pytest
data_arg = ["arg1", "arg2"]
class TestParentClass1:
@pytest.fixture(scope="class", params=data_arg,...
0
votes
0
answers
17
views
Writing a test method for an async service layer method
I have a repository layer that does a few CRUD operations. I want to write unit tests for the methods in this class to make sure they work as expected etc.
Here is my repository layer:
using Microsoft....
0
votes
1
answer
42
views
Asserting attribute change after transaction, using Foundry test network
Context
I am trying to test whether a function receiveInvestment() external payable { that receives currency from a wallet address private _investorWallet; changes the uint256 private _someStoredValue;...
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
) => {...