|
|
Re: Multiple unittest files to be executed by Maven [message #1805567 is a reply to message #1805520] |
Wed, 17 April 2019 14:00 |
Christoph Brewing Messages: 3 Registered: April 2019 |
Junior Member |
|
|
At least, I solved the symptoms of my issue. However, I have to admit that I do not understand the solution. Here is the review:
The symptom was that only those unittests were executed by Maven which were part of the original (auto generated) file, e.g. MyDslParsingTest.xtend.
Unittests of other files, e.g. MyDslWHATEVERTest.xtend, were not considered by Maven at all. Eventually, I compared the two file types and discovered differences in the "setup" (I mean: imports and injections).
Unittests in this file are executed by Maven: MyDslParsingTest.xtend
import com.google.inject.Inject
import org.eclipse.xtext.testing.InjectWith
import org.eclipse.xtext.testing.extensions.InjectionExtension
import org.eclipse.xtext.testing.util.ParseHelper
import org.example.hellomaven.helloMaven.Model
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.^extension.ExtendWith
@ExtendWith(InjectionExtension)
@InjectWith(HelloMavenInjectorProvider)
class HelloMavenParsingTest {
@Inject ParseHelper<Model> parseHelper
@Test
...
Unittests in this file are NOT executed by Maven: MyDslWHATEVERTest.xtend
import com.google.inject.Inject
import org.eclipse.xtext.testing.InjectWith
import org.eclipse.xtext.testing.XtextRunner
import org.eclipse.xtext.xbase.testing.CompilationTestHelper
import org.junit.Test
import org.junit.runner.RunWith
import static org.junit.Assert.*
@RunWith(typeof(XtextRunner))
@InjectWith(typeof(SismicInjectorProvider))
class HelloMavenWHATEVERTest {
@Inject extension CompilationTestHelper
@Test
...
The "setup" of the latter, I finally modified it to the following:
Unittests in this file ARE now executed by Maven: MyDslWHATEVERTest.xtend
import com.google.inject.Inject
import org.eclipse.xtext.testing.InjectWith
import org.eclipse.xtext.testing.extensions.InjectionExtension
import org.eclipse.xtext.xbase.testing.CompilationTestHelper
import org.eclipse.xtext.testing.XtextRunner
import org.junit.runner.RunWith
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.^extension.ExtendWith
@ExtendWith(InjectionExtension)
@InjectWith(SismicInjectorProvider)
class SismicGenerationTest implements completeScenarioWithFrancaReferences {
@Inject extension CompilationTestHelper
@Test
...
The thrilling thing for me was that in the Eclipse IDE, I could launch all tests from all files. Everything was working. However, Maven had a different perspective ...
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.06183 seconds