Skip to content

Commit 64493f1

Browse files
feat: ✨ upgrade deps ollama integration
1 parent 8cf2c1e commit 64493f1

File tree

5 files changed

+59
-6
lines changed

5 files changed

+59
-6
lines changed
Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Karate Test Runner
1+
name: Karate Test Runner with Ollama LLM
22

33
on: [push]
44

@@ -7,16 +7,35 @@ jobs:
77
runs-on: ubuntu-latest
88

99
steps:
10-
- uses: actions/checkout@v2
10+
# Paso 1: Clonar el repositorio
11+
- uses: actions/checkout@v4
12+
13+
# Paso 2: Configurar Java 17
1114
- name: Set up JDK 17
1215
uses: actions/setup-java@v2
1316
with:
1417
java-version: '17'
1518
distribution: 'adopt'
16-
- name: API Testing
19+
20+
# Paso 3: Instalar Dependencias de Maven
21+
- name: Install Maven Dependencies
22+
run: mvn clean install
23+
24+
# Paso 4: Levantar Ollama en Docker
25+
- name: Start Ollama LLM with Docker
26+
run: docker run -d -p 11400:11400 ollama/ollama
27+
28+
# Paso 5: Generar Datos Dinámicos
29+
- name: Generate Dynamic Test Data
30+
run: mvn test "-Dkarate.options=src/test/java/examples/ia/generate.feature"
31+
32+
# Paso 6: Ejecutar Pruebas con Karate DSL
33+
- name: Run Karate Tests
1734
run: mvn clean test "-Dkarate.options=--tags @run"
35+
36+
# Paso 7: Publicar Reportes
1837
- name: Publish Test Report
19-
uses: mikepenz/action-junit-report@v2
20-
if: always() # always run even if the previous step fails
38+
uses: mikepenz/action-junit-report@v5
39+
if: always()
2140
with:
2241
report_paths: 'target/karate-reports/*.xml'

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<java.version>17</java.version>
1313
<maven.compiler.version>3.8.1</maven.compiler.version>
1414
<maven.surefire.version>2.22.2</maven.surefire.version>
15-
<karate.version>1.5.0</karate.version>
15+
<karate.version>1.5.1</karate.version>
1616
</properties>
1717

1818
<dependencies>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
@run
2+
Feature: Validar reserva de vuelos con datos dinámicos
3+
4+
Scenario: Validar creación de reserva
5+
* def testData = read('src/test/resources/test-data.json')
6+
Given url 'https://api.instantwebtools.net/v1/passenger'
7+
And request {
8+
name: '#(testData.flight.name)',
9+
flightNumber: '#(testData.flight.flightNumber)',
10+
date: '#(testData.flight.date)',
11+
class: '#(testData.flight.class)'
12+
}
13+
When method post
14+
Then status 201
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
function() {
2+
var scenarios = [
3+
"Reserva de vuelos con nombre, fecha, número de vuelo y clase.",
4+
"Detalles de transacciones bancarias con usuario, monto y fecha.",
5+
"Catálogo de productos con nombre, categoría, precio y disponibilidad.",
6+
"Información de libros con autor, título, fecha de publicación y género.",
7+
"Simulación de compras en línea con usuario, productos y total."
8+
];
9+
10+
var prompt = "Genera datos JSON realistas para los siguientes escenarios: " + scenarios.join(" ");
11+
var response = karate.call('http://localhost:11400/generate', { prompt: prompt });
12+
return response.data;
13+
}
14+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Feature: Generación de datos realistas para pruebas automatizadas
2+
3+
Scenario: Crear datos dinámicos para múltiples escenarios
4+
* def generateTestData = call read('generate-test-data.js')
5+
* def testData = generateTestData()
6+
* karate.write(testData, 'src/test/resources/test-data.json')

0 commit comments

Comments
 (0)