-
-
Notifications
You must be signed in to change notification settings - Fork 399
Introduce new testing layout #229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to me
auth/auth_test.go
Outdated
@@ -49,7 +57,7 @@ func TestToken(t *testing.T) { | |||
} | |||
|
|||
// Obtain info | |||
req, err := http.NewRequest("GET", "https://auth.arduino.cc/v1/users/byID/me", nil) | |||
req, err := http.NewRequest("GET", "https://ddauth.arduino.cc/v1/users/byID/me", nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a typo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(for context, tests are green because this specific test is skipped on Travis, found out when it was too late)
Introduce new testing layout
Replace broken website publishing script link
Overview
The project currently has a robust test suite that exercises most of the functionalities against the actual http API. This is not very suitable to iterate fast on the code, thus this PR introduces the concept of unit tests in addition to the existing suite that will stay as it is but will be marked as "integration tests".
Implementation
Integration test functions will contain the string
Integration
in the name, so that the suite can be run withgo test -run integration ./...
. Integration tests will be skipped when running unit tests and we use theshort
option from the Go standard lib to make this easy: each test function will begin like this:This way, unit tests will be run with just
go test -short ./...
To make easier for contributors and the CI to run either of the suites, or both in sequence, a task runner was added.
task
is written in Go and can be easily installed by justgo get
so it should be fair to ask developers to have it in their dev env. Available tasks are defined in theTaskfile.yml
file, with this PR you can dotask test-unit
to run all the unit tests, or (for example)task test-unit TARGETS=./auth
to run all the unit tests for theauth
package only.task test-integration
is symmetric whiletask test
will run both integration and unit tests.Note that
go test ./...
will keep running all the tests so the use oftask
is not mandatory.