Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.

Commit 7b5ae48

Browse files
Adição de configurações para o vscode rodar testes;
Melhorias nos scripts de execução de testes para poder rodar um arquivo específico;
1 parent b43db14 commit 7b5ae48

32 files changed

+228
-21
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"python.testing.unittestArgs": [
3+
"-v",
4+
"-s",
5+
"./tests",
6+
"-p",
7+
"test_*.py"
8+
],
9+
"python.testing.pytestEnabled": false,
10+
"python.testing.unittestEnabled": true
11+
}

examples/lambda_api/README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,14 @@ First you need install the tests requirements:
103103

104104

105105
### Unit tests:
106+
Executing the tests:
106107
```
107108
./scripts/venv-exec.sh ./scripts/tests/unit-tests.sh
108109
```
110+
Executing a specific file:
111+
```
112+
./scripts/venv-exec.sh ./scripts/tests/unit-tests.sh /tests/unit/test_app.py
113+
```
109114
### Components tests:
110115
Start the docker containers:
111116
```
@@ -116,6 +121,10 @@ Executing the tests:
116121
```
117122
./scripts/venv-exec.sh ./scripts/tests/component-tests.sh
118123
```
124+
Executing a specific file:
125+
```
126+
./scripts/venv-exec.sh ./scripts/tests/component-tests.sh /tests/component/test_app.py
127+
```
119128
### Integration tests:
120129
Copy the file `config/integration.env.example` to
121130
`config/integration.env` and edit it with de staging parameters.
@@ -124,7 +133,10 @@ Executing the tests:
124133
```
125134
./scripts/venv-exec.sh ./scripts/tests/integration-tests.sh
126135
```
127-
136+
Executing a specific file:
137+
```
138+
./scripts/venv-exec.sh ./scripts/tests/integration-tests.sh /tests/integration/test_app.py
139+
```
128140

129141
### All tests:
130142
Executing the tests:

examples/lambda_api/scripts/tests/component-coverage.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
coverage run -m unittest discover -s ./tests/component -t ./
1+
if [ -z "$1" ]; then
2+
coverage run -m unittest discover -s ./tests/component -t ./
3+
else
4+
coverage run -m unittest discover -s ./tests/component -t $1
5+
fi
26
coverage report
37
coverage xml -o ./target/component/report.xml
48
coverage html --omit="*/test*,venv/*,vendor/*" -d ./target/component/coverage_html/
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
python3 -m unittest discover -s ./tests/component -t ./
1+
if [ -z "$1" ]; then
2+
python3 -m unittest discover -s ./tests/component -t ./
3+
else
4+
python3 -m unittest discover -s ./tests/component -t $1
5+
fi

examples/lambda_api/scripts/tests/integration-coverage.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
coverage run -m unittest discover -s ./tests/integration -t ./
1+
if [ -z "$1" ]; then
2+
coverage run -m unittest discover -s ./tests/integration -t ./
3+
else
4+
coverage run -m unittest discover -s ./tests/integration -t $1
5+
fi
26
coverage report
37
coverage xml -o ./target/integration/report.xml
48
coverage html --omit="*/test*,venv/*,vendor/*" -d ./target/integration/coverage_html/
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
python3 -m unittest discover -s ./tests/integration -t ./
1+
if [ -z "$1" ]; then
2+
python3 -m unittest discover -s ./tests/integration -t ./
3+
else
4+
python3 -m unittest discover -s ./tests/integration -t $1
5+
fi
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
#python -m xmlrunner discover -t ./ --output-file ./target/unit/junit-report.xml
2-
python3 -m coverage run -m unittest discover -s ./tests/unit -t ./
1+
if [ -z "$1" ]; then
2+
python3 -m coverage run -m unittest discover -s ./tests/unit -t ./
3+
else
4+
python3 -m coverage run -m unittest discover -s ./tests/unit -t $1
5+
fi
36
python3 -m coverage report
47
python3 -m coverage xml
58
coverage2clover -i ./target/unit/report.xml -o ./target/unit/clover.xml

examples/lambda_api/scripts/tests/unit-coverage.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
#python -m xmlrunner discover -t ./ --output-file ./target/unit/junit-report.xml
2-
coverage run -m unittest discover -s ./tests/unit -t ./
1+
if [ -z "$1" ]; then
2+
coverage run -m unittest discover -s ./tests/unit -t ./
3+
else
4+
coverage run -m unittest discover -s ./tests/unit -t $1
5+
fi
36
coverage report
47
coverage xml
58
coverage html
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
python3 -m unittest discover -s ./tests/unit -t ./
1+
if [ -z "$1" ]; then
2+
python3 -m unittest discover -s ./tests/unit -t ./
3+
else
4+
python3 -m unittest discover -s ./tests/unit -t $1
5+
fi
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"python.testing.unittestArgs": [
3+
"-v",
4+
"-s",
5+
"./tests",
6+
"-p",
7+
"test_*.py"
8+
],
9+
"python.testing.pytestEnabled": false,
10+
"python.testing.unittestEnabled": true
11+
}

0 commit comments

Comments
 (0)