All Questions
Tagged with testing unit-testing
6,645
questions
0
votes
0
answers
18
views
ParameterizedTest JUNIT5 with suspend functions
I'm trying to clean a little bit my code and when testing my datasource I'm repeating a lot the test that returns connection and service error, and I'd like to have a bunch of code that tests ...
0
votes
0
answers
29
views
Django Internationalization test error:Couldn't retrieve redirection page
I wrote a blog project in Django,in some pages i used loginrequierdmixin to make sure user is loged in but in test i got error
test:
def test_get_profile_unauthenticated(self):
response = ...
0
votes
0
answers
12
views
Testing provider in flutter which depends on Firebase
I am trying the following test:
@GenerateMocks([Tour])
void main() {
group('TripProvider', () {
test('add Trip', () async {
final mockTrip = MockTour();
TripProvider provider = ...
0
votes
1
answer
28
views
How to test Amazon Athena queries
I have a rather complicated Athena query, which I would like to test on a local machine without connecting to Athena. I specified some mock data for testing purposes, and I was hoping that I could use ...
1
vote
1
answer
52
views
How can I test that the PHP code under test calls the proper method on a trait?
Edit: After reading one of the comments, I realized I misspoke pretty badly in the original post, I've made some edits to clarify. Essentially, I need to check the results but am struggling with that ...
-1
votes
1
answer
30
views
XCode tests issue: 'any Protocol' does not conform to expected type 'Protocol' insert 'as! Protocol'
Started adding tests to supplementary objects
Tested class code:
class TokenAdapter {
private let tokenProvider: TokenProviderProtocol!
private let session: SessionProtocol!
// MARK: - Init
...
0
votes
1
answer
27
views
Testing Value Objects in DDD, "Implementing Domain Driven Design"
In the book "Implementing Domain Driven Design" of Vaughn Vernon, in the Testing of Value Objects section, the author talks about how we can use just shallow copy instead of deep copy to ...
-3
votes
1
answer
38
views
Go: test fails when expected value is the same as got value [closed]
I'm learning to test http endpoints in Go with the httptest library and my test is failingeven though by the result it should pass.
The function being tested:
func testHandler(w http.ResponseWriter, r ...
3
votes
2
answers
80
views
Can you test whether a function is actually running Asynchronously?
I'm working on a ASP.NET Web Api project to learn the framework and the testing for it and I was wondering if you could test that Asynchronous methods are actually running Asynchronously (or are they ...
-1
votes
0
answers
76
views
How to test a server action function?
I have a nextjs server action that uses mssql for node to connect with the database.
The following is pizza.actions.ts:
export async function get_pizza_id(pizza_name: string) {
try {
if(!...
1
vote
1
answer
59
views
How to unit test for multipart.Form
I need to write tests for that function:
func Parse(f *multipart.Form) ([]Person, error)
It's important to say, that multipart.Form.Value is not just key:value, thats more complicated json, simple ...
1
vote
1
answer
117
views
TS2305: Module '@angular/core/testing' has no exported member async
I updated angular version from 17 to 18 and because of which some modules are no longer supporter especially in spec.ts files while importing them.
Like async from @angular/core/testing and **...
1
vote
2
answers
48
views
How can I write a test with Xunit that accepts an enum as parameter?
I try to write a test that looks like this:
private static readonly IEnumerable<MyEnumType> ListOfEnumValues = Enum.GetValues(typeof(MyEnumType)).Cast<DocumentType>();
private static ...
0
votes
1
answer
21
views
Can I use built-in Microsoft DI in unit tests for init objects?
in unit tests for init and create the objects I would like to use buit-in Microsoft DI, is it good practice?
0
votes
0
answers
9
views
Testing on Loom testnet
I try to deploy it on Loom testnet: truffle.js test --network loom_testnet
**This is my configtion Loom testnet in config-truffle.js : **
enter image description here
AND THIS IS I GOT THIS ERROR
...
1
vote
0
answers
30
views
Nested ViewChilds in Angular component, unit testing
I have a parent component, where in my template i have button :
<button
actions
data-cy="appointment-creation-calendar"
*ngIf="tabIndex === 1"
[...
1
vote
0
answers
68
views
Test suite failed to run ReferenceError: TextEncoder is not defined
I am trying to test my project using a mock API instead of a real one to save money. However, when I add the following code to my setupTests.js file:
// setupTests.js
import { server } from "./...
0
votes
1
answer
41
views
MockMvc test always returns 200 regardless of JWT authorities
@Test
public void testGetOrders() throws Exception {
mockMvc.perform(get("/admin/api/orders/")
.with(jwt().authorities(new SimpleGrantedAuthority("...
1
vote
1
answer
70
views
How to unit test logic under AG GRID gridApi function forEachNode
Trying to get my unit test coverage for this bit of code:
processUpdates(input) {
let request = [];
this.gridApi.forEachNode(function (node) { // <--- How to mock/spy inside forEachNode
...
1
vote
0
answers
36
views
How to create more detailed log of unit tests?
The objective will be to be able to generate a document with a more detailed restitution of the tests carried out than what the framework offers; with input data, result data and an explanatory ...
-1
votes
1
answer
27
views
Flask unit test failing due to FileNotFoundError for private key file [duplicate]
I'm trying to run unit tests on a Flask application that utilizes public and private keys for JWT token generation. However, when running my unit tests, I'm getting a FileNotFoundError indicating that ...
1
vote
2
answers
43
views
Run JUnit tests from multiple projects at once
I have a repository of projects, each containing JUnit tests. I am looking for either a method or a framework to run them all at once, instead of manually running for each project.
After some research ...
0
votes
0
answers
27
views
How to identify the best method to test a function in Android Studio?
Below is a function in our Android application designed to update the app with a new installation of its current version. However, each approach I've attempted has encountered significant obstacles, ...
0
votes
0
answers
50
views
Test that a Dart stream does not emit anything, without listening to it
I am currently working on a Flutter app, but my question is solely related to Dart. I need to implement a repository which exposes an outbound stream of data. This repository's responsibility is to ...
0
votes
1
answer
46
views
Mock patching an endpoint unittest that makes several requests to third party
I have a single endpoint written using django ninja. This endpoint executes a crawler that performs several requests. The sequence of requests has 3 different routines depending on whether or not the ...
0
votes
0
answers
42
views
Python unittest how to mock function which external function is defined in __init__.py
I would like to test my_func2 that is calling my_func1. I would like to mock my_func1, but I don't know how can I do it when my_func2 is imported in my_package.__init__.py. When I delete that import, ...
0
votes
0
answers
20
views
Error when trying to add BA-DUA in project
This is my first time with BA-DUA, and online there isn't so much to learn about (at least where I searched). I wanted to add this tool for data-flow testing coverge in my project. I added this in my ...
0
votes
0
answers
47
views
How to run cypress component tests from storybook play function
I'd like to run cypress component tests from storybook play button. Is it possible?
Example:
export const Default: Story = {
play: async ({ canvasElement }) => {
cy.mount(canvasElement);
...
0
votes
0
answers
26
views
How I can test location service, and it's permissions with junit?
Is it possible to write to write instrumental tests and later on for location permissions? I'm relatively new to testing topic, and I haven't found much examples that could possibly help me with it.
1
vote
0
answers
42
views
How can I skip/disable running of unittests in rustc bootstrap build testing?
I am running rustc bootstrap build tests via the commandline:
python3 src/bootstrap/bootstrap.py test --exclude "some excluded test cases list" --no-fail-fast --bless --target x86_64-poky-...