Skip to content

Commit

Permalink
remove old files and add contributions guidelines
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelpcabral committed Aug 18, 2024
1 parent fe3a742 commit 789fc19
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 240 deletions.
4 changes: 0 additions & 4 deletions .flake8

This file was deleted.

9 changes: 0 additions & 9 deletions .pre-commit-config.yaml

This file was deleted.

25 changes: 0 additions & 25 deletions .travis.yml

This file was deleted.

122 changes: 40 additions & 82 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,113 +1,71 @@
# ***** UNDER CONSTRUCTION *****
# Development environment

Feel free to create issues for ideas for new functionality with other aws services

We are working to create an environment with tests in localstack https://github.com/localstack/localstack if you have
experience with this tool and time, any help will be appreciated.


## Contributing to RobotFramework-AWS

Thank you for considering contributing to a library for interacting with AWS Services in RobotFramework for Test Automation.
Thank you for considering contributing to a library for interacting with AWS services in RobotFramework
for test automation.

Let's go over setting up the development environment.

Setup virtualenvironment:
Configure your environment as desired, the requirements are in the requirements.txt file

```sh
python -m venv venv
pip install -r requirements.txt
```

activate
## Testing

```sh
source venv/bin/activate
```
### Localstack

install dependencies
For now, we have inside the folder localstack the docker compose file and in the init-aws.sh the commands to send
for localstack.

To start localstack just run inside localstack folder:
```sh
pip install -r requirements.txt
docker-compose up
```
Then you can use inside robot, the endpoint http://localhost:4566

set environment variables for aws as ACCESS_KEY and SECRET_KEY
### Robot Framework

install package development setup from root directory where setup.py is
The tests suites are inside tests/robot folder

```sh
pip install -e .
```

## TESTING
The common variables, keywords and libraries should be in common.resource file. The tests suites have the
aws module name like s3.robot or sqs.robot then we can run it separately.

For every keyword or method created, will be followed with two different tests. Unit and Robot tests.
Located in the tests directory are separated tests by type unit/robot.
Any extra file like txt, json, csv or similar should be inside data folder.

Robot Tests will need a configuration file added to the root of robot/ for tests to run.

`run_arguments.robot`
The robot files should import only the common.resource.

```robotframework
## SUITE NAME
--name AWS Library Testing
## SETTINGS
# tools must be in same directory as run_arguments.robot
--pythonpath ./AWSLibrary
--pythonpath .
# LOG LEVEL
# --loglevel DEBUG
--loglevel INFO
# put all logs into directory
--outputdir reports
# --timestampoutputs
--debugfile debug.log
## VIRTUAL DISPLAY
-v USE_XVFB:True
## PROXY
-v USE_PROXY:False
-v PROXY_TYPE:socks
-v PROXY_HOST:localhost
-v PROXY_PORT:9999
## VARIABLES
-v ACCESS_KEY:
-v SECRET_KEY:
testsuites/
```

## Local AWS Services with Localstack

```sh
docker-compose up -d

*** Settings ***
Resource common.resource
Suite Setup Create Session And Set Endpoint
Suite Teardown Delete All Sessions
```

<http://localhost:8055/>
All the libraries import should be in common.resource, as the suite setup.

Make sure and add your aws credentials in the variables section.
```robotframework
*** Settings ***
Library ${CURDIR}/../../src/AWSLibrary
Library Collections
Library OperatingSystem
Unit tests and Robot Tests are automated with tox. You can run tox to test your build before committing your changes
```sh
tox
*** Keywords ***
Create Session And Set Endpoint
Create Session With Keys ${REGION} ${ACCESS_KEY} ${SECRET_KEY}
SQS Set Endpoint Url http://localhost:4566 # Point to localstack sqs instance
S3 Set Endpoint Url http://localhost:4566 # Point to localstack s3 instance
```

Upon pushing your branch. Tox will run and travis ci will run the reports

Tox will grab the AWS environment variables that you set. which you can see in tox.ini

### Pre Commit

We use flake8 for checking for linting errors
### TO-DO

Git Secrets will run on commit to make sure there are no hardcoded credentials in any files

Upon pushing your branch. Tox will run and travis ci will run the reports

### Issues

Feel free to create issues for ideas for new functionality with other aws services
* Create CloudWatch and DynamoDB in localstack and create robot tests
* Add more services in library and in localstack
* Add robot tests for this new services
* Create GitHub actions to run the tests in push and merges.
76 changes: 0 additions & 76 deletions Dockerfile

This file was deleted.

3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,4 @@ Test Case

### Attention Contributors

The project development contribution session and local testing with "localstack" is under construction and needs to be
reviewed, contributions are welcome.

[Contribution guidelines for this project](CONTRIBUTING.md)
39 changes: 0 additions & 39 deletions deploy-ghpages.py

This file was deleted.

1 change: 1 addition & 0 deletions tests/robot/data.resource → tests/robot/common.resource
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Library ${CURDIR}/../../src/AWSLibrary
Library Collections
Library OperatingSystem


*** Variables ***
${REGION} us-east-1
${ACCESS_KEY} dummy
Expand Down
2 changes: 1 addition & 1 deletion tests/robot/s3.robot
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
*** Settings ***
Resource data.resource
Resource common.resource
Suite Setup Create Session And Set Endpoint
Suite Teardown Delete All Sessions

Expand Down
5 changes: 4 additions & 1 deletion tests/robot/sqs.robot
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
*** Settings ***
Resource data.resource
Resource common.resource
Suite Setup Create Session And Set Endpoint
Suite Teardown Delete All Sessions

Expand All @@ -11,6 +11,7 @@ ${INVALID_QUEUE} invalid-queueName

*** Test Cases ***
Send and Recieve Message
[Tags] sqs
Send Message To SQS ${QUEUE_NAME} Hello world!
Sleep 2
${messages} Receive Messages From SQS ${QUEUE_NAME}
Expand All @@ -20,6 +21,7 @@ Send and Recieve Message
Should Be Equal ${actual_value} Hello world!

Invalid Queue Name
[Tags] sqs
TRY
Send Message To SQS ${INVALID_QUEUE} Hello world!
EXCEPT AS ${error}
Expand All @@ -28,6 +30,7 @@ Invalid Queue Name
Should Be Equal ${error} Queue name '${INVALID_QUEUE}' not found.

Delete Messages
[Tags] sqs
Delete All Messages In SQS ${QUEUE_NAME}
${messages} Receive Messages From SQS ${QUEUE_NAME}
${count} Get Length ${messages}
Expand Down

0 comments on commit 789fc19

Please sign in to comment.