Acroplia test task
In this task, I have to write a CLI tool that will interact with Acroplia API and Web interface. Furthermore, I have to cover it with automated and manual tests.
Parts to be done:
- Login page
- Creating textpad
- Sending a private message
Parts that are done:
- Login page
- Creating textpad
- Sending a private message
Build and Install
- Run Selenium server in separate terminal:
java -jar selenium-standalone-server.jar
- When running tests using gradle, you have to kill process of selenium-standalone-server. Using linux:
ps aux | grep java; kill {process_id}. Using windows: use task manager.
Using go
- Download and install golang
- Build executable:
go build main.go
- Run executable:
./acroplia --help
- Run tests:
go test -v ./...
Using gradle
- Build executable:
gradle goBuild
- Run executable:
./acroplia --help
- Run tests:
gradle testAll - to run all tests
gradle testLoginAPI - to run tests for login through API
gradle testLoginWeb - to run tests for login through Web
gradle testTextpadAPI - to run tests for creating textpad through API
gradle testTextpadWeb - to run tests for creating textpad through Web
gradle testMessageAPI - to run tests for sending message through API
gradle testMessageWeb - to run tests for sending message through Web (currently server sends 500 Internal Server Error even when message is sent)
NOTE: apparently it takes plenty of time to build executable, I recommend to use native Go way to build executable.
Project structure
cmd - contains cli tool's root code
config - contains configuration files, for now just config.toml
drivers - contains Selenium drivers, for now Chrome and Firefox are tested
gradle - contains gradle related config vars
internal - contains code for connecting to API or Web interface
internal/crud_test - contains manual tests for API
internal/services_test - contains manual tests for Selenium
tests - contains automated tests and test cases
Program flags
--log, -l {filename|filepath} - store program logs in separate file, by default all logs are written to stdout (can be .json)
--debug, -d - turn on debugging mode, will print more info about program's steps
--email {your_email} - email in Acroplia used for login
--password {your_password} - password in Acroplia used for login, required for login by: username, email or phone
--username {your_username} - username in Acroplia used for login (through API only)
--phone {phone_number} - phone in Acroplia used for login
--output, -o {filename|filepath} - store response body from API calls in separate file, by default response body is written to stdout
--selenium-port {number} - port on which Selenium standalone server is listening
--selenium-browser {browser_name} - browser to be used by Selenium
--selenium-options {string[]...} - additional options for Selenium browser (like --headless and etc)
--help, -h - to view additional flags for each command
NOTE: in case if you don't prefer using flags, you can add all info to config/config.toml file.