I am using testify in Go to write unit tests for my service methods and all the methods are working fine excepted the update method because in the upd ...
I am using testify in Go to write unit tests for my service methods and all the methods are working fine excepted the update method because in the upd ...
For example, I have this test here and I want this to return true. Obviously, I can clean up the string with strings.TrimSpace(), strings.ReplaceAl ...
I've mocked a repository interface and I want to return a specific value when a method is called. However, it always returns what's in the dummy imple ...
I want to add custom flags for my Go tests that use testify/suite. It looks like from this thread that it can only be in TestMain() (init() if it is b ...
I use Testify to create a unit test for my golang app. I need to create a unit test for this function where it calls a variadic function (function wit ...
I want to execute subtests using the testify/suite package. I am declaring my Unit suite as follows type UnitSuite struct { suite.Suite } func ...
I have this function that I wanna test. I use testify to create the unit test. // calculate.go import ( "context" "errors" "testing" "github ...
I'm trying to create a unit test on Go using testify. The function I'm trying to test is quite simple, it'll start an SQL transaction, and then get va ...
I have an use case method that call a mocked repository method two times with a different parameter I've written it somewhat like this running the ...
Is there an easy and compact way using Testify to assert that a slice of pointers to strings contains a pointer to a string that matches my expectatio ...
I have an interface called localcache: package localcache type Cache interface { Set(k string, v interface{}) error Get(k string) (interfac ...
I'm trying to create integration tests for my REST API application which I made using gorilla/mux, gorm.io and golang-migrate/v4 For the tests I'm us ...
I am writing unit tests for Method1() I want to mock Method2() that is called from Method1() of the same interface. We can mock methods of another i ...
I have a user service that validates the user data and formats it and then calls Firebase service which creates a firebase user and return firebase id ...
Consider this unit test file in Go. I'm using github.com/stretchr/testify/mock package. type Person struct {Name string; Age int} type Doer struct { ...
I'm new to Go here. I am trying to test the function call inside my Go routine but it fails with the error message Expected number of calls (8) do ...
Golang beginner here. I am trying to write tests for my struct which eventually mocks out the stats interface. The relevant part of my code looks belo ...
I have a fun little weather app. For only $99/day, the app will check the weather daily, and if it's raining in Seattle, send an umbrella to the peopl ...
I'm using testify for testing. I've set up a suite for my tests. However, I'm having trouble using the set up and tear down features when using table ...
So I have some pipeline. I have to compare 2 files, line by line and e.g load to database. I want to have some timeout for handling single line, and b ...