Popularity
1.3
Stable
Activity
5.1
-
10
2
4

Programming language: Go
License: MIT License
Tags: Testing     Testing Frameworks    

stop-and-go alternatives and similar packages

Based on the "Testing Frameworks" category.
Alternatively, view stop-and-go alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of stop-and-go or a related project?

Add another 'Testing Frameworks' Package

README

stop-and-go

Actions Status codecov Go Report Card PkgGoDev License: MIT

Testing helper for concurrency

Install

go get -u github.com/elgohr/stop-and-go

Usage

func TestExample(t *testing.T) {
    w1 := wait.NewWaiter(time.Second)
    w2 := wait.NewWaiter(time.Second)
    w3 := wait.NewWaiter(time.Second)

    ts1 := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
        w.WriteHeader(http.StatusOK)
        w2.Done()
    }))
    defer ts1.Close()

    go func() {
        w3.Done()
    }()

    go func() {
        if _, err := http.Get(ts1.URL); err != nil {
            t.Error(err)
        }
        w1.Done()
    }()

    if err := wait.For(
        constraint.NoOrder(w3),
        constraint.Before(w1, w2),
    ); err != nil {
        t.Error(err)
    }
}


*Note that all licence references and agreements mentioned in the stop-and-go README section above are relevant to that project's source code only.