Cucumber N26 API for Golang
n26godog
provides cucumber/godog
steps for testing N26 API.
Prerequisites
Go >= 1.17
Install
go get github.com/nhatthm/n26godog
Usage
For example:
package mypackage
import (
"testing"
"github.com/cucumber/godog"
"github.com/nhatthm/n26godog"
)
func TestIntegration(t *testing.T) {
server := n26godog.New(t)
suite := godog.TestSuite{
Name: "Integration",
TestSuiteInitializer: nil,
ScenarioInitializer: func(ctx *godog.ScenarioContext) {
server.RegisterContext(ctx)
},
Options: &godog.Options{
Strict: true,
Output: out,
Randomize: rand.Int63(),
},
}
// Initiate your client and run it with the suite.
status := suite.Run()
}
Steps
Authentication
^n26 receives a login request with username "([^"]+)", password "([^"]+)" and device id "([^"]+)" but the credentials is wrong
^n26 receives a login request with username "([^"]+)", password "([^"]+)" and device id "([^"]+)" but no one confirms login
^n26 receives a success login request with username "([^"]+)", password "([^"]+)" and device id "([^"]+)"
^n26 receives a refresh token request but the token is invalid
^n26 receives a success refresh token request
Transactions
^n26 receives a request to find all transactions in between "([^"]+)" and "([^"]+)"(?: with page size ([0-9]+))? and responses:$
^n26 receives a request to find all transactions in between "([^"]+)" and "([^"]+)"(?: with page size ([0-9]+))? and responses with result from file:$
Examples
See https://github.com/nhatthm/n26godog/tree/master/features
Donation
If this project help you reduce time to develop, you can give me a cup of coffee :)
Paypal donation
or scan this