JUnit 5 does not execute method annotated with BeforeEach

In my case the problem was that the @Test annotation was taken from wrong import.
Originally it was imported from org.junit.Test.
Once I have switched it to org.junit.jupiter.api.Test the problem was resolved.

Wrong original code:

import org.junit.Test;

@BeforeEach
...some code

@Test
...some code

Correct fixed code:

import org.junit.jupiter.api.Test;

@BeforeEach
...some code

@Test
...some code

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)