gradle / gradle/exemplar

JUnit runners don't handle @Before nor @After

Open
#42 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
36
Forks
13
Avg merge
7h 36m
Merged PRs (30d)
4

Description

Using `@RunWith(GradleSamplesRunner::class)` or `@RunWith(SamplesRunner::class)`

### Expected Behavior

`@Before` and `@After` functions to be invoked properly

### Current Behavior

`@Before` and `@After` functions silently ignored

### Context

I wanted to skip some samples under certain conditions in a `@Before` function using JUnit `Assume`. I didn't find a satisfying way so far.

`@BeforeClass` and `@AfterClass` are already handled by the parent `ParentRunner`.

Contributor guide

No contributing guide indexed for this repository

Research direction

Locate the GradleSamplesRunner and SamplesRunner implementations and compare their lifecycle handling with the parent ParentRunner, which already handles @BeforeClass and @AfterClass. Reproduce the issue with a sample using @Before and @After, then verify that both methods run and that JUnit Assume can affect sample execution.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.