Skip to content

Commit 5b91ff4

Browse files
chore: GitHub Action workflow (#3)
* chore: workflow to execute API testing
1 parent 3f7cc63 commit 5b91ff4

File tree

4 files changed

+35
-2
lines changed

4 files changed

+35
-2
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Karate Test Runner
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v2
11+
- name: Set up JDK 17
12+
uses: actions/setup-java@v2
13+
with:
14+
java-version: '17'
15+
distribution: 'adopt'
16+
- name: API Testing
17+
run: mvn clean test "-Dkarate.options=--tags @run"
18+
- name: Publish Test Report
19+
uses: mikepenz/action-junit-report@v2
20+
if: always() # always run even if the previous step fails
21+
with:
22+
report_paths: 'target/karate-reports/*.xml'

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
</p>
66

77
# API Test Automation - Karate DSL For Restful and GraphQL APIs
8-
## Starter project creado en vivo en stream de Twitch de [@CharlyAutomatiza](https://www.twitch.tv/charlyautomatiza) basado en [Karate DSL](https://karatelabs.github.io/karate/).
8+
## Starter project creado en vivo en stream de [Twitch.tv/CharlyAutomatiza](https://www.twitch.tv/charlyautomatiza) basado en [Karate DSL](https://karatelabs.github.io/karate/).
99

1010
### Requerimientos generales
1111

@@ -48,3 +48,13 @@ Para ejecutar todos los tests tanto de API Rest como de GraphQL se puede ejecuta
4848
Luego de cada ejecución se genera dentro de la carpeta **target/karate-reports** los reportes en formato html.
4949

5050
Para más detalle se puede consultar [la documetación oficial](https://karatelabs.github.io/karate/#test-reports)
51+
52+
### Github Actions para ejecutar los test de APIs
53+
54+
Nueva carpeta [**.github/workflows**](.github/workflows) con el archivo [**karate-test-runner.yml**](.github/workflows/karate-test-runner.yml) para ejecutar nuestros tests desde un pipeline de Github Actions.
55+
56+
JUnit Report obtenido desde [Marketplace de GitHub](https://github.com/marketplace/actions/junit-report-action)
57+
58+
El workflow está configurado para que se ejecute ante el siguiente evento:
59+
60+
* **push**: cuando se hace un push a un repositorio

src/test/java/examples/ExamplesTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class ExamplesTest {
1111
void testParallel() {
1212
Results results = Runner.path("classpath:examples")
1313
.outputCucumberJson(true)
14+
.outputJunitXml(true)
1415
.parallel(5);
1516
assertEquals(0, results.getFailCount(), results.getErrorMessages());
1617
}

src/test/java/examples/usersgql/users-gql.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,4 @@ Examples:
5353
| variables | username | address |
5454
| { id: 1 } | Bret | { geo:{ lng: 81.1496, lat: -37.3159 } }|
5555
| { id: 2 } | Antonette | { geo:{ lat:-43.9509, lng: -34.4618 } }|
56-
| { id: 3 } | Samantha | { geo:{ lat:-68.6102, lng: -34.4618 } }|
56+
| { id: 3 } | Samantha | { geo:{ lat:-68.6102, lng: -47.0653 } }|

0 commit comments

Comments
 (0)