Trips Service
Overview
This is the Trips API for the MyDriving service.
The server was generated by the swagger-codegen project.
By using the OpenAPI-Spec from a remote server, you can easily generate a server stub.
Build & Test
Get dependencies
go get
Build the Application
go build
Testing
Unit Tests
To run unit tests and get coverage report, execute:
go test -v ./tripsgo -run Unit -coverprofile=trips_coverage.out -covermode=count
To run unit tests and get coverage report and junit report use gotestsum tool, execute:
./gotestsum --format standard-verbose --junitfile unittest_results.xml -- ./tripsgo -run Unit -coverprofile=unittest_coverage.out -covermode=count
Integration Tests
-
Add a file called .evn to the tripsgo folder with the following structure:
SQL_SERVER="<-- your database server uri -- >" SQL_PASSWORD="<-- your login password -- >" SQL_USER="<-- your login user -- >" SQL_DBNAME="<-- your database name -- >" SQL_DRIVER="mssql"
You shouldn't need to change the SQL_DRIVER variable.
-
To run all integration tests, execute:
go test -v ./tripsgo
-
To run all integration tests and get junit report use gotestsum tool, execute:
./gotestsum --format standard-verbose --junitfile integrationtest_results.xml -- ./tripsgo
Note
This requires an actual database connection, so the required ENV variables need to be present.