Cannot dynamically skip scenario during BeforeScenario hook
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 25/100
Línea de trabajo
Start by tracing how @BeforeScenario hooks handle SkipScenarioException and how the runner reports a skipped scenario; the issue provides a minimal Java hook and spec that reproduce the behavior. Check the existing scenario hook and skip handling tests, then add or adapt a regression case for the skip tag. Done means the scenario is reported as skipped and its step does not run; an open linked pull request already addresses this issue.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
Throwing SkipScenarioException in @BeforeScenario hook doesn't mark the scenario as skipped as expected.
To Reproduce
My goal is to use a custom skip tag to explicitly skip a scenario from a suite.
Here is a minimal example.
Using this implementation:
public class GaugeConfig {
@BeforeScenario(tags = "skip")
public void skipScenario() {
System.out.println("skip " + context.getCurrentScenario().getName() + "...");
throw new SkipScenarioException("Tagged to skip");
}
@Step("Print <message>")
public void print(String message) {
System.out.println("running " + message);
}
}
And this spec:
# My spec
## Scenario 1
* Print "scenario 1"
## Scanario 2
Tags: skip
* Print "scenario 2"
Extract of pom.xml
<dependencies>
<dependency>
<groupId>com.thoughtworks.gauge</groupId>
<artifactId>gauge-java</artifactId>
<version>0.12.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>2.0.17</version>
</dependency>
</dependencies>
Logs
C:\Gauge\bin\gauge.exe run --machine-readable --hide-suggestion --simple-console C:/test-gauge-java/specs/MySpec.spec
Testing started at 14:04 ...
[pool-1-thread-1] INFO org.reflections.Reflections - Reflections took 106 ms to scan 1 urls, producing 2 keys and 2 values
[pool-2-thread-1] INFO org.reflections.Reflections - Reflections took 3 ms to scan 1 urls, producing 0 keys and 0 values
running scenario 1
skip Scanario 2...
running scenario 2
Successfully generated html-report to => C:\test-gauge-java\reports\html-report\index.html
Specifications: 1 executed 1 passed 0 failed 0 skipped
Scenarios: 2 executed 2 passed 0 failed 0 skipped
Total time taken: 217ms
Process finished with exit code 0
Expected behavior
In my example the scenario 2 should be marked as skipped and not executed.
Versions:
- Java 21
gauge -v
Gauge version: 1.6.18
Commit Hash: d6e10a4
Plugins
-------
flash (0.0.2)
html-report (4.3.3)
java (0.12.0)
json-report (0.5.0)
screenshot (0.3.2)
spectacle (0.2.1)
xml-report (0.5.2)
- Lenguaje dominante
- Java
- Estrellas
- 99
- Forks
- 51
- Merge medio
- 1 d 1 h
- PR fusionados (30 d)
- 8
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de getgauge/gauge-java
-
Dificultad 3/5 1-2 días Aptitud para principiantes 42/100
getgauge/gauge-java#946 · 2 comentarios ·
-
help wanted
Dificultad 3/5 1-2 días Aptitud para principiantes 38/100
getgauge/gauge-java#619 · 6 comentarios · 3 reacciones ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
getgauge/gauge-java#548 · 5 comentarios ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
getgauge/gauge-java#466 ·
-
bug Windows
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
getgauge/gauge-java#429 · 1 comentario ·
Todos los issues de getgauge/gauge-java
Issues similares
-
status: waiting-for-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
spring-projects/spring-framework#37614 ·
Los mantenedores suelen responder en 1 día
-
azure-spring azure-spring-aad Client
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Azure/azure-sdk-for-java#51046 · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
helm-knative-apply.sh fails with Helm 4Posiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertoarea: triage theme: undefined
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
jhipster/generator-jhipster#35895 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
oracle/graalvm-reachability-metadata#11659 ·
Los mantenedores suelen responder en 1 día