Skip to main content
Filter by
Sorted by
Tagged with
-1 votes
3 answers
125 views

My class doesn't generate a Fibonacci sequence properly

I'm trying to make a class that generates a Fibonacci sequence. My two modules are below, the fibonacci.py module and the test_fibonacci.py module. The first two tests pass but the third one seems to ...
JSO's user avatar
  • 21
0 votes
0 answers
33 views

How can I use the same test_helper function in integration tests and unit tests in rust?

So I have an integration test /tests/my_test.rs and a unit test in /src/some_module/function.rs. If I create a test helper in /tests/test_helper.rs pub struct TestHelper { } impl TestHelper { fn ...
vextorspace's user avatar
0 votes
2 answers
55 views

How to test debouncing logic

I'm trying to use TDD to build a search view model that debounces before searching. Until recently I would have created a mock debouncer, injected it into my view model and used that to control the ...
ADB's user avatar
  • 685
1 vote
1 answer
35 views

Why is Karate scenario and scenario outline generating parantheses before the name?

Am using a simple Karate runner to run my features. But the karate html output is generating my scenario thus. Its adding the [1:1:22] as prefix to the Card is not used scenario name. How can i remove ...
Lester Gray's user avatar
2 votes
1 answer
56 views

Angular testing: Error: NG0304: 'mat-form-field' is not a known element (used in the 'SignInComponent' component template)

Im trying to do a small app with TDD. When i run npm test following error occurs: Error: NG0304: 'mat-form-field' is not a known element (used in the 'SignInComponent' component template): If 'mat-...
edgario's user avatar
  • 21
0 votes
2 answers
75 views

TDD process when you know the implementation of a new feature overlaps a previous one [closed]

I just solved this puzzle using TDD: https://adventofcode.com/2015/day/6 I started with turnOn function and implemented like this(F#): let turnOn (startx, starty) (endx, endy) (grid: bool[,]) = ...
Mehdi.Valizade's user avatar
1 vote
0 answers
34 views

Best approach for doing Test-Driven Development with Kernel Mode Windows driver

I have an existing kernel-mode device driver that implements a installable file system (IFS) for Windows. As there are several parts of the driver that should not require operating inside the kernel ...
penguin359's user avatar
  • 1,489
0 votes
1 answer
55 views

How to TDD and fully test templated code that takes variadic number of arguments and which has specializations without code duplication in the tests?

Let's say I want to write a function that returns sum of passed positive numbers. Just returns 0 if I don't pass any. And I decide that I want to pass arguments just as a list of arguments and as a ...
KulaGGin's user avatar
  • 1,214
1 vote
2 answers
59 views

TDD, Unit Test and mocks injection: What about the Single Responsability principle?

I'm writing a Unit Test for a Class (CustomHttpClient) that internally uses a library (java.net.http.HttpClient) to make an external HTTP call. Being it a Unit Test, I would mock the internal ...
javacomelava's user avatar
-1 votes
1 answer
109 views

How to set an EXPECT_CALL to a mock object that is just created?

Here is my situation with testing. There is a note in googletest that EXPECT_CALL’s must be set first before the calls on mock methods (https://google.github.io/googletest/gmock_for_dummies.html#...
PopherTheG's user avatar
1 vote
1 answer
54 views

Maintaining test isolation and not testing implementation with API wrappers

I'm new to Test Driven Development and I've been thinking about how to test some API wrappers which perform modifications on the received data so it complies with my own custom format. I ran into an ...
CyborgOctopus's user avatar
1 vote
1 answer
162 views

Can I write one expectation in RSpec which demands a method is called only once with specific arguments?

I'm just finishing my first year writing production code in Rails, and I'm not really stuck here, but the non-rubyness of what I'm experiencing is weird, and I wanted to see if anyone had this problem....
Louis Pate's user avatar
0 votes
0 answers
66 views

Stubbing requests in ActiveJob for jobs enqueued by other jobs using Rails, Rspec, and WebMock

I'm writing tests for a Job in my Rails app. When the Job receives over 500 messages, it enqueues other jobs to handle the messages. When it receives less than 500 messages, it handles the messages ...
Sebastian Scholl's user avatar
2 votes
1 answer
119 views

Mock EncryptAsync method and return EncryptResult from Azure.Security.KeyVault.Keys.Cryptography

I am trying to mock the functionality of the EncryptAsync method in Azure.Security.KeyVault.Keys.Cryptography.CryptographyClient. This is the method I am trying to cover in my unit test. public ...
mohanraj's user avatar
1 vote
1 answer
71 views

Encapsulation in Typescript for export functions

I am new to Typescript, but with my JAVA Knowledge, I believe exporting functions breaks Encapsulation principles. for example: hello.ts ** Below method will be called from outside *** export const ...
shukla's user avatar
  • 67
0 votes
1 answer
28 views

TDD when DDD with lots of dependency in information model

The system is designed with entities for each of the business elements. Each entity is represented as a class with methods for its behavior and property for its data. We map the entity to the database ...
Daggen's user avatar
  • 51
0 votes
3 answers
395 views

Testing SwiftData models in test target, "failed to find a currently active container"

I'm building out a SwiftData model in the preliminary stages of app development. I'm using test-driven development (tdd) to iterate on the model and iron out kinks prior to integrating the model into ...
pkamb's user avatar
  • 34.9k
1 vote
2 answers
111 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 ...
helloworld123's user avatar
0 votes
1 answer
51 views

Is there a boilerplate template for a TDD approach in Django-Python

I’m working on a side a project while trying to discipline myself to get accustomed to the TDD approach in Django. I'm not sure why I’m running into this failed test (venv) osahenru@osahenru ~/D/q-4&...
osahenru's user avatar
0 votes
0 answers
103 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 ) => {...
Umer's user avatar
  • 1
3 votes
1 answer
322 views

@DataJpaTest & @SpringBootTest querying src/main/resources database instead of src/test/resources database

Im trying to thoroughly understand Spring Boot, especially testing. I want all tests to run against the database in application.properties inside src/test/resources regardless of the active profile. ...
theMyth's user avatar
  • 248
3 votes
1 answer
172 views

How can I return self from a method mocked using mockall?

Given the following test context which makes use of the mockall library, how can I satisfactorily return a reference to cmd that will allow me to make assertions about subsequently chained method ...
pdoherty926's user avatar
  • 10.3k
0 votes
1 answer
38 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 ...
nandu's user avatar
  • 23
2 votes
2 answers
327 views

Testing DAO Methods in Java: Fake Implementations vs. In-Memory Databases

I’m currently working on a Java project using Java 17, Dropwizard, and JUnit 5, and I’m focusing on improving my unit tests and adopting Test-Driven Development (TDD) practices. My application ...
Kamil Gajdzinski's user avatar
0 votes
0 answers
74 views

Unable to consume message - MassTransit with ActiveMQ Artemis

public class MessagePublisher : BackgroundService { private readonly ILogger<MessagePublisher> _logger; private readonly IBusControl _busControl; private readonly IMessageIcd ...
hfl's user avatar
  • 11
0 votes
0 answers
89 views

Make a Unit Test E2E for Blazor Web App in .NET 8 Backend

How can make TDD for a Blazor Web App in .NET 8, how can test my backend API? Any idea how write E2E tests? Thanks.
Jon...'s user avatar
  • 309
0 votes
0 answers
43 views

I'm having this error in my app ruby on rails

StandardError Directly inheriting from ActiveRecord::Migration is not supported. Please specify the Active Record release the migration was written for: class AddAttachmentImageToPosts < ...
phskaterock's user avatar
0 votes
1 answer
592 views

Setting up/using a session in a phpunit test

I have a simple class that wraps around serializing/deserializing an array of objects and adding them to the session and I want to test it. The errors I've gotten are the there is no session ...
JasonM's user avatar
  • 165
1 vote
1 answer
778 views

Unit test framework for .net maui hybrid blazor app with .net 8 and target Android and Windows

I just wondered which unit test framework to use in a .NET MAUI Blazor Hybrid app with multiple targets like Android and Windows. I already tried nUnit and xUnit, but it is not working out of the box. ...
GeKu's user avatar
  • 63
2 votes
0 answers
175 views

CMock's behaviour for IgnoreAndReturn

I am currently trying to understand the intricacies of CMock's IgnoreAndReturn feature. This is the function under test void USBDriver_Exec(void) { uint8_t Val; // When ...
Iberico's user avatar
  • 182
0 votes
0 answers
269 views

Testing Cerner CCL Query Data with Oracle's Unit Testing Framework

I've been looking for a unit-testing framework for Cerner CCL (now with Oracle), and it looks like one does exist here: https://github.com/cerner/cclunit-framework/blob/main/doc/CCLUNITTESTS.md For ...
Cdn_Dev's user avatar
  • 765
1 vote
3 answers
131 views

Why should I use triangulation instead of just randomized values in my tests?

Since I started learning and using TDD I was wondering something about the "triangulation technique": why bother writing multiple tests when we could write one that use randomized values? ...
Opack's user avatar
  • 113
1 vote
0 answers
83 views

Is Test Driven Development possible in jetpack compose?

Is TDD (Test Driven Development) impossible since testing compose requires that the UI to be tested already exists? Or are you creating a FakeScreen and testing it?
yhlee2's user avatar
  • 21
0 votes
1 answer
109 views

Rails tests are passing but server refuses to start on production due to syntax error [closed]

This is one weird issue I am facing. All the test cases are passing on the CI/CD but there's a syntax error in one of the files. And when this changes goes to production the server refuses to start. ...
aks's user avatar
  • 9,441
0 votes
0 answers
33 views

The non-nullable local variable 'mockLoginRespository' must be assigned before it can be used

I am trying to develop my app using Clean TDD (Test Driven Development) Architecture. For the login feature , I am writing the test case as follows: import 'package:dartz/dartz.dart'; import 'package:...
Allen P Biju's user avatar
1 vote
2 answers
162 views

Unittest in according to TDD on Palindrome

I'm student at QA and now I try to write a palindrome code in Python based on TDD and unittest. I tried to write the code and it is functional but it doesn't work in according to assertTrue, also I ...
SPGA's user avatar
  • 11
0 votes
2 answers
167 views

Is there a simple way to invert a test or test group?

Assume you have written a failing test to exploit a bug. You want to push this to upstream and then create a story that is about fixing the code so that the test passes. However, this is prevented by ...
klutt's user avatar
  • 31.2k
1 vote
0 answers
52 views

How would you develop a function for API response parsing using TDD?

I just read "Test Driven Development: By Example" by Kent Beck, and I am trying to apply it on my current project. Given an API response I need to extract information from it. API response ...
hardhypochondria's user avatar
0 votes
1 answer
237 views

Ignore the rest of a function after asserting that a function is called in python

In Python, we want to assert that a function is called when calling another function. However, we want to ignore the execution after calling the required function. This necessity appears when we don't ...
Mounir's user avatar
  • 17
0 votes
2 answers
70 views

How to verify that a specific method was called with this parameter or another parameter using mockito?

How to verify that my sendMessage method is called with Msg.SAVE or with Msg.UPDATE using mockito's verify method. @Service public class CustomerService { private final CustomerRepository ...
obela06's user avatar
  • 335
-1 votes
3 answers
472 views

How to write a test case to check if numbers in an array are unique when the array is created randomly?

I'm writing a specification for a lottery function that should create an array of seven (random) numbers between 1 and 49. The numbers in the array must be unique, a result like [1, 2, 3, 4, 5, 6, 6] ...
spacePirate's user avatar
1 vote
2 answers
85 views

What am I doing wrong in bdd / gherkin?

I'm learning about BDD, Behavior-Driven Development, and while I caught the "idea" of having examples of the system's behavior, which we can execute and through which we can develop it, I'm ...
JosePepeDev's user avatar
1 vote
2 answers
123 views

How to unit test your Abstract data type without getters and setters in C?

I am currently trying to refactor some of my embedded C code and am trying to apply what James W. Grenning is recommending in his Test-Driven Development for Embedded C book. For this, I am dividing ...
kokopelli's user avatar
  • 262
1 vote
0 answers
65 views

How to write Table Driven Development test?

I am trying to write TDD for the following code. But, I cant able to cover 100% coverage in my test code. Can anyone give me the correct code to cover my test? The following codes are used to connect ...
Venukishore.R's user avatar
0 votes
1 answer
175 views

Same tests for controllers and services in NestJS API (Test Driven Development)

I'm developing a NestJS-based API using Prisma and MySQL for the database. As I'm new to Test Driven Development (TDD), I want to start incorporating tests into my project. I have successfully written ...
Sn0w's user avatar
  • 17
0 votes
0 answers
86 views

Pytest - execute test case only if previous test case fails

I have two test cases test_A(a,b,c) and test_B(a,b,c) in a python file. I use parameterization ( metafunc.parametrize("a,b,c",[(a1,a2,a3),....(y1,y2,y3)]) to pass 6 set of parameters ...
yowaf21832's user avatar
0 votes
1 answer
143 views

How to do unit test on database connection function?

I have a Flask app that use this function to connect to DB server: @contextmanager def db_connection(name): server = os.environ.get(name + '_SERVER') database = os.environ.get(name + '...
FrankZhu's user avatar
  • 514
1 vote
1 answer
76 views

What type of tests should I use for writing a test with TDD?

I come from a PHP (Laravel) background and have just switched to Python. I am a big fan of TDD and have previously been writing 'feature' tests. Now I am writing AWS Lambdas (which are making lots of ...
Mick's user avatar
  • 1,551
0 votes
1 answer
146 views

How do you test the each element inside String Array in java Junit5?

Let's say I have this following String Array String[] expected = new String[]{"rock", "paper", "scissor"}; Sounds dummy, I am fairly new junit5, how do you do test ...
reichan's user avatar
0 votes
0 answers
84 views

Chai assertion is passing even thought it should fail

I am fetching the array of objects "subscriptions" which should return me array with 3 subscriptions in it. But when I try to fail the test by asserting it with length 2, it passes. Is ...
Smit Padaliya's user avatar

1
2 3 4 5
123