Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AbstractOutlineTest: @Before and @BeforeEach annotations are missing on the overriden setUp() method. #3010

Closed
miklossy opened this issue Apr 24, 2024 · 1 comment
Assignees
Milestone

Comments

@miklossy
Copy link
Contributor

Whenever executing an outline test with JUnit5 runner, the following popup window opens:
screenshot

Steps to reproduce:

  1. Create the Xtext Hello World MyDsl project using JUnit5 support.
  2. Add the following test case to the org.xtext.example.mydsl.ui.tests project:
package org.xtext.example.mydsl.ui.tests

import org.eclipse.xtext.testing.InjectWith
import org.eclipse.xtext.testing.extensions.InjectionExtension
import org.eclipse.xtext.ui.testing.AbstractOutlineTest
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.^extension.ExtendWith

@ExtendWith(InjectionExtension)
@InjectWith(MyDslUiInjectorProvider)
class MyDslOutlineTest extends AbstractOutlineTest {

	@Test def test() {
		'''
			Hello World!
		'''.assertAllLabels('''
			test
			  World
		''')
	}
}
  1. Execute the test case as JUnit Plug-in Test, the popup described above appears.

Reason: The Xtext Nature should be added by the overriden setUp method, but it is not executed, since the @Before and @BeforeEach annotations are missing. These annotations are not inherited, see junit-team/junit5#960 (comment) , so they should be repeated also on the overridden method,

Solution: Repeat the annotations on the setUp() method of the AbstractOutlineTest class, similar to the setUp method of the AbstractCursorHandlingTest class.

@miklossy miklossy added this to the Release_2.35 milestone Apr 24, 2024
@miklossy miklossy self-assigned this Apr 24, 2024
miklossy added a commit that referenced this issue Apr 24, 2024
Signed-off-by: miklossy <miklossy@itemis.de>
miklossy added a commit that referenced this issue Apr 24, 2024
Signed-off-by: miklossy <miklossy@itemis.de>
miklossy added a commit that referenced this issue Apr 25, 2024
Signed-off-by: miklossy <miklossy@itemis.de>
LorenzoBettini pushed a commit that referenced this issue Apr 25, 2024
Signed-off-by: miklossy <miklossy@itemis.de>
@LorenzoBettini
Copy link
Contributor

Fixed by #3011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants