Category "unit-testing"

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

Node js - Node Path : How to find the Node Path on a windows machine

Hi, Please see the attached picture for the settings of the extension Ponicode - used to automate unit tests How do I find the Node Path for node js on my wind

Mock functions in Go

I'm puzzled with dependencies. I want to be able to replace some function calls with mock ones. Here's a snippet of my code: func get_page(url string) string {

How to correctly set Mock Row and Query for go-sqlmock

I'm setting up testing in golang. I use go-sqlmock to test mysql connection. But sqlmock.NewRows and mock.ExpectQuery does not work well with error. I want to k

Silverlight unit testing integration in VS 2010?

I'm currently using the Silverlight Unit Test Framework, but I'd prefer to run tests directly in VS2010. I'm curious to know what approaches and tools everyone

How to mock a ES6 singleton class with Jest?

I have a dependency that is a singleton class like so: // dependency.js class Dependency { foo() { ... } } export default new Dependency(); I'm trying to

How to mock an IFormFile for a unit/integration test in ASP.NET Core?

I want to write tests for uploading of files in ASP.NET Core but can't seem to find a nice way to mock/instantiate an object derived from IFormFile. Any suggest

ERROR in ./src/polyfills.ts Module not found: Error: Can't resolve 'zone.js/dist/zone'

I have an angular 8, that uses karma/jasmine to run some unit tests. I can run tests by executing the following command ng test but I'm getting the following er

parametrized tests with Mocha

How can I create parametrized tests with Mocha? Sample use case: I have 10 classes, that are 10 different implementations of the same interface. I want to run