unit-testing Questions
1
I have tried everything I've been able to find, but I can't get tests to work when httpx AsyncClient is used.
I encountered two errors when running a test:
RuntimeError: This event loop is already...
Fibrosis asked 31/3, 2021 at 21:30
2
I want to write tests for my FastAPI endpoints
example for my code:
from fastapi import FastAPI
from fastapi.testclient import TestClient
app = FastAPI()
@app.get("/todos")
async def ge...
Selfpreservation asked 26/4, 2022 at 7:2
7
Solved
I have some common set up code that I've factored out to a method marked with @Before. However, it is not necessary for all this code to run for every single test. Is there a way to mark it so the ...
Destructive asked 10/10, 2009 at 16:53
5
I am writing unit test for angular app, I am testing if the service function returns a value.
component.spec.ts
import {TopToolBarService} from '../../top-toolbar/top-toolbar.service';
beforeEac...
Oxbow asked 10/10, 2019 at 21:26
12
Solved
One of my django application unit test fails with
DatabaseError: ORA-00942: table or view does not exist
I would like to see actual SQL query that caused this error. Do you know how to achieve t...
Rosaliarosalie asked 31/10, 2012 at 16:42
3
Solved
While calling a function from unit test in Flutter (Dart), how can I find if I am running unit test or real application?
I want to pass different data if it's in unit test.
Platter asked 25/11, 2019 at 9:25
3
I'm trying to mock one of Typeorm module function in Jest and I want to do it in cleanest possible way. What I managed to create that works:
jest.mock("typeorm", () => ({
__esModule: ...
Hufuf asked 12/5, 2021 at 19:18
2
Solved
I have a project with several large test cases in it and the project takes about 2-3 minutes to build. I am suspicious that it has to do with this new warnings feature... for example:
warning xU...
Dedal asked 14/6, 2017 at 14:20
12
Solved
I have this production method:
public boolean onShouldOverrideUrlLoading(String url) {
boolean isConsumed = false;
if (url.contains("code=")) {
Uri uri = Uri.parse(url);
String authCode = uri....
Bandage asked 16/8, 2015 at 13:36
6
Solved
As I understand, lenient silences the exceptions thrown by StrictStubbing. Based on this, lenient shouldn't be used, maybe only temporary while doing TDD, because strict stubbing exceptions would g...
Sanious asked 26/2, 2020 at 18:20
4
How do I mock router.url in angular 4 unit testing?
I use router.url in ngOnint in my component but in my test the value for router.url is '/'
Pampuch asked 18/9, 2017 at 5:9
5
Solved
While running a particular unittest with pytest, it occasionally fails with this error (mentioned in the title) and from the stack trace it happens on the line
choice = input().lower()
when the c...
Calcium asked 18/7, 2018 at 2:52
3
Suppose that I have the following unit test class:
class Test(unittest.TestCase)
def setUp(self) -> None:
self.test_parameter1 = 'A'
self.test_parameter2 = 'B'
@parametrized.expand([('A',)...
Bruges asked 12/2, 2021 at 17:18
12
I tried to run Visual Studio tests in ASP.NET MVC by pressing "Run All" but all tests were skipped. Why did this happen and how can I run all tests? Here is a screenshot:
Pitterpatter asked 11/10, 2012 at 12:54
1
I have a class that receives an AVCaptureDevice object as a parameter and I'd like to test it. I found the swizzle method to create an instance of AVCaptureDevice
extension AVCaptureDevice {
clas...
Bebeeru asked 5/6 at 22:13
9
I have an Xcode 5 unit test project and some test xml files related to it. I've tried a bunch of approaches but I can't seem to load the xml files.
I've tried the following which does not work
NS...
Oberg asked 3/10, 2013 at 5:25
13
I'm writing a Jest mock, but I seem to have a problem when defining a mocked function outside of the mock itself.
I have a class:
myClass.js
class MyClass {
constructor(name) {
this.name = name;...
Jadwiga asked 21/8, 2018 at 23:0
10
Solved
I'm trying to write tests for a react component I've built that utilizes navigator.geolocation.getCurrentPosition() within a method like so (rough example of my component):
class App extends Compo...
Trevino asked 24/3, 2017 at 20:51
3
Solved
Also shared here: https://github.com/tomakehurst/wiremock/issues/625
I'm writing an integration test to verify that my application that interacts with a REST API handles unsuccessful requests appro...
Casie asked 8/3, 2017 at 0:49
3
Solved
So I have a class that has a method that logs a message:
class Car {
private Logger logger = LoggerFactory.getLogger(Car.class);
void startCar() {
logger.error("car stopped working");
}
}
...
Subtraction asked 26/6, 2014 at 19:58
8
Solved
I'm currently converting my MsTest unit tests to xUnit. With xUnit, is there a way to test exception messages? Is it correct to test exception messages as opposed just the exception type?
Orfield asked 21/3, 2011 at 10:50
2
I have created a new angular app v13 using cli with the defaults. I replaced the app.component.html file to display 4 images. This loads in the browser fine doing npm start. When I run npm test and...
Pastoralize asked 26/2, 2022 at 22:31
6
How do I write unit tests for those endpoints of my API that require oAuth authentication?
Simply adding oAuth tokens to the request headers doesn't work (perhaps because the test database is not...
Caliginous asked 13/5, 2015 at 7:11
2
Solved
My one test file with 7 empty tests is taking 5+ seconds to start running. I've used both flutter test and the Dart test runner in VS Code, and they both take about the same amount of time.
My whol...
Clonus asked 29/5, 2022 at 15:28
2
Solved
I'm trying to create a simple way to test string parameters in unit tests, for most string parameters, I want to check the behaviour when the parameter is Null, Empty or consists only of whitespace...
Harmaning asked 15/12, 2015 at 8:45
© 2022 - 2024 — McMap. All rights reserved.