- Helps avoid undeterministic tests
- Helps have faster tests, because you wait enough (No more or less :))
go get github.com/rShetty/asyncwait or, just add `github.com/rShetty/asyncwait` as dependency and preferably fix a version. func doWork(workChan chan int, something Something) go func() { for i := 0; i < 5; i++ { workChan <- i } } something.call() }workChan := make(chan int) maxWaitInMillis := 100 pollIntervalInMillis := 20 doWork(workChan) // Check for the length of channel to be 5 predicate := func() bool { return len(workChan) == 5 } successful := NewAsyncWait(maxWaitInMillis, pollIntervalInMillis).Check(predicate) if successful != true { // You fail } // Assert call was called on somethingWorking examples of usage can be found here