Category "unit-testing"

Separating unit tests and integration tests in Go

Is there an established best practice for separating unit tests and integration tests in GoLang (testify)? I have a mix of unit tests (which do not rely on any

_vuex.default.store is not a constructor

I'm trying to test a component that uses vuex inside it, I'm trying to pass the store of the respective component so that it can be assembled, but I'm getting t

how to pass screen.height & screen.width in vue test case | Jest Framework

I have used screen.height & screen.width for js operations. I can't able to pass the test case. (code coverage). I am using vue utils - Jest framework. belo

How to disable Morgan (request logger) during unit test?

I use Morgan (default express generator request logger), and I'm trying to disable it during unit testing. Currently I'm using the default configuration, which

Moq verifies in debug and fails sometimes in run

I've developed a wpf-mvvm application that uses wmi to document what is built into a given Computer into a json file. I've used the mvvm model to develop the ap

How to correctly structure SQLAlchemy (declarative style) python project and it`s unittests

I am developing large backend for some web apps. This is my first python and SQLAlchemy project, so I am confused with some things. And was kind of spoiled by J

Assert to check string contains only numeric values

I want to write a JUNIT test case for checking that a String contains only numeric values. Can anybody suggest me to do so. I am new to junit test case and i cu

How to use Mockito with JUnit5

How can I use injection with Mockito and JUnit 5? In JUnit4 I can just use the @RunWith(MockitoJUnitRunner.class) Annotation. In JUnit5 is no @RunWith Annotati

Writing unit tests for tapir endpoints (API Layer) in scala

I have created tapir endpoints in scala, where the architecture of the project is such that API layer calls service layer and service layer calls repo layer. I

jasmine: Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL

I have an angular service called requestNotificationChannel: app.factory("requestNotificationChannel", function($rootScope) { var _DELETE_MESSAGE_ = "_DEL

Using junit @Rule, expectCause() and hamcrest matchers

I have a test: @Rule public ExpectedException thrown = ExpectedException.none(); ... @Test public void testMethod() { final String error = "error message";

Pass complex parameters to [Theory]

Xunit has a nice feature: you can create one test with a Theory attribute and put data in InlineData attributes, and xUnit will generate many tests, and test th

How to implement google mock to mock the C fopen function

I am writing a unit test for embedded C codes using google test/mock. The C function code looks like this. int readGPIOSysfs(int ioport){ ... FILE *f = fop

How to mock Repository/Unit Of Work

In my app I have generic repository connected to controller through UnitOfWork. I want to unit test my app. To make this I need to mock db connection. Can you t

xUnit shared context by private static fields

What disadvantages have an approach of sharing context by creating private static fields? If I don't need to call Dispose? public class MyTests3 : IDisposable {

phpunit - testing is painfully slow

I am diving deeper and deeper in the world of unit testing. One issue I encountered, and this is where I would like feedback, is when one runs multiple test su

Angular/Karma unit test error "1 timer(s) still in the queue"

This is hardly first encounter I've had with "1 timer(s) still in the queue", but usually I find some way to use tick() or detectChanges(), etc., to get out of

Gradle stack trace on terminal

I'm required to use Gradle for my Java project. I'm running some unit tests with ./gradlew test, but the exception stack trace is witten on a web page which I n

Cache "go get" in docker build

I want to encapsulate my golang unit testing in a docker-compose script because it depends on several external services. My application has quite a lot of depen

How to assert an actual value against 2 or more expected values?

I'm testing a method to see if it returns the correct string. This string is made up of a lot of lines whose order might change, thus usually giving 2 possible