Skip to content
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

Convert to Go Modules and standardize package structure #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea/
44 changes: 12 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,41 +16,21 @@ To build, configure, and test the Roku WebDriver and Roku Robot Framework Librar

1. [Download](https://golang.org/dl/) and install the Go programming language (the Roku WebDriver server is implemented as a Go application).

1. Clone this repository or download it as a zip file.

2. Clone this repository or download it as a zip file.
1. Run the Roku WebDriver project:

```bash
go run cmd/main.go
```

3. Set the "GOPATH" environment variable to the path of the **automated-channel-testing-master** folder ($APP_PATH).
1. Test the Roku WebDriver server following these steps:

```bash
go test ./...
```

4. Install the following dependencies ([mux](https://github.com/gorilla/mux/blob/master/README.md) is a URL router and dispatcher; [logrus](https://github.com/sirupsen/logrus/blob/master/README.md) is a structured logger):

cd <path>/automated-channel-testing-master/src
go get github.com/gorilla/mux
go get github.com/sirupsen/logrus

5. Build the Roku WebDriver project:

go build main.go

6. Run the **main** executable in the **/automated-channel-testing-master/src** folder to start the Roku WebDriver server.


7. Test the Roku WebDriver server following these steps:

a. Install the [**assert**](https://godoc.org/github.com/stretchr/testify/assert) package, which provides testing tools to be used with Go applications.

go get github.com/stretchr/testify/assert

b. Test the ECP client:

go test ecpClient

c. Test the HTTP server (the host is "localhost"; the port used is 9000):

go test httpServer

8. Run Roku's Python-based sample WebDriver client application following these steps:
1. Run Roku's Python-based sample WebDriver client application following these steps:

a. Download and install python: https://www.python.org/downloads.

Expand All @@ -67,7 +47,7 @@ To build, configure, and test the Roku WebDriver and Roku Robot Framework Librar
python <path>/automated-channel-testing-master/sample/script/main.py


9. Configure and test the Roku Robot Framework Library following these steps:
1. Configure and test the Roku Robot Framework Library following these steps:

a. Install the dependencies listed in the **/automated-channel-testing-master/RobotLibrary/requirements.txt** file:

Expand All @@ -84,4 +64,4 @@ To build, configure, and test the Roku WebDriver and Roku Robot Framework Librar

python -m robot.run --outputdir Results --variable ip_address:192.168.1.94 --variable server_path:D:/projects/go/webDriver/src/main.exe Tests/Basic_tests.robot

10. View the generated test case report and log, which are stored in the specified output directory.
1. View the generated test case report and log, which are stored in the specified output directory.
8 changes: 4 additions & 4 deletions src/main.go → cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
package main

import (
httpServer "httpServer"
"github.com/rokudev/automated-channel-testing/pkg/httpServer"
)

func main() {
server := httpServer.GetServerInstance()
server.Start()
}
server := httpServer.GetServerInstance()
server.Start()
}
9 changes: 9 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module github.com/rokudev/automated-channel-testing

go 1.14

require (
github.com/gorilla/mux v1.7.4
github.com/sirupsen/logrus v1.4.2
github.com/stretchr/testify v1.5.1
)
23 changes: 23 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/gorilla/mux v1.7.4 h1:VuZ8uybHlWmqV03+zRzdwKL4tUnIp1MAQtp1mIFE1bc=
github.com/gorilla/mux v1.7.4/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894 h1:Cz4ceDQGXuKRnVBDTS23GTn/pU5OE2C0WrNTOYK1Uuc=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
10 changes: 5 additions & 5 deletions src/ecpClient/ecp_client.go → pkg/ecpClient/ecp_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
package ecpClient

import (
"errors"
"fmt"
"image"
"io"
"net/http"
"net/url"
"time"
"image"
"errors"
)

const RequestTimeoutMilliseconds = 30000
Expand Down Expand Up @@ -79,7 +79,7 @@ func (ec *EcpClient) SetTimeout(timeout time.Duration) {
}

func (ec *EcpClient) GetTimeout() int {
ms := int(ec.HttpClient.HttpClient.Timeout/time.Millisecond)
ms := int(ec.HttpClient.HttpClient.Timeout / time.Millisecond)
return ms
}

Expand Down Expand Up @@ -219,11 +219,11 @@ func (ec *EcpClient) InstallChannel(channelId string) (bool, error) {
if err != nil {
return false, err
}

return ec.makeNavigationRequest("POST", end)
}

func (ec *EcpClient) LaunchChannel(channelId string, contentId string , mediaType string ) (bool, error) {
func (ec *EcpClient) LaunchChannel(channelId string, contentId string, mediaType string) (bool, error) {
if len(channelId) == 0 {
return false, errors.New("the channelId is required")
}
Expand Down
Loading