danieldietrich / xtext-protected-regions

Xtext Protected Regions
danieldietrich.net
12 stars 6 forks source link

Tests in Xtext fail after installing Protected Regions #47

Open dersvenhesse opened 10 years ago

dersvenhesse commented 10 years ago

I've got some unit tests running with XtextRunner in the test project of my DSL, they were running pretty fine until I installed Protected Regions.

Now there is an error java.lang.NoClassDefFoundError: Lorg/slf4j/Logger.

After removing Protected Regions, the tests are running fine again. I was able to recreate the issue on multiple machines and assume there is an dependency problem related to Protected Regions.

ceefour commented 10 years ago

The error message is pretty self-explanatory. Please add slf4j to your project. On Jul 19, 2014 6:39 PM, "dersvenhesse" notifications@github.com wrote:

I've got some unit tests running with XtextRunner in the test project of my dsl, they were running pretty fine until I installed Protected Regions.

Now there is an error java.lang.NoClassDefFoundError: Lorg/slf4j/Logger.

After removing Protected Regions, the tests are running fine again. I was able to recreate the issue on multiple machines and assume there is an dependency problem related to Protected Regions.

— Reply to this email directly or view it on GitHub https://github.com/danieldietrich/xtext-protected-regions/issues/47.

dersvenhesse commented 10 years ago

I don't think so. The tests wouldn't run without Protected Regions if slf4j was missing. As I said, I assume the Protected Regions are interfering somehow with the XtextRunner.

ceefour commented 10 years ago

Try adding slf4j and see if you can run your tests. On Jul 19, 2014 7:42 PM, "dersvenhesse" notifications@github.com wrote:

I don't think so. The tests wouldn't run without Protected Regions if slf4j was missing.

As I said, I assume the Protected Regions are interfering somehow with the XtextRunner.

— Reply to this email directly or view it on GitHub https://github.com/danieldietrich/xtext-protected-regions/issues/47#issuecomment-49508524 .

dersvenhesse commented 10 years ago

I already tried, they don't run. But later I will try to create a step by step guidance to recreate the issue.

dersvenhesse commented 10 years ago
  1. Create a new Xtext project with default settings as MyDsl.
  2. Run the MWE2 workflow.
  3. Add new Xtent class AnyTest to the test project (code block at the end of these steps).
  4. Build the project and run the new test class as JUnit test. The test runs successful and without a failure.
  5. Add Protected Regions to the MyDslRuntimeModule in the default package.
  6. Run the test again. Now the test fails und errors trace puts the error mentioned in my first post.
  7. If you add comments around the createEclipseResourceFileSystemAccess2 method for Protected Regions in MyDslRuntimeModule, the test runs perfect again.
package org.xtext.example.mydsl.tests

import org.eclipse.xtext.junit4.XtextRunner
import org.xtext.example.mydsl.MyDslInjectorProvider
import org.junit.runner.RunWith
import org.eclipse.xtext.junit4.InjectWith
import org.junit.Test

import static org.junit.Assert.*

@InjectWith(MyDslInjectorProvider)
@RunWith(XtextRunner)
class AnyTest {

    @Test
    def void anythingTest() {
        assertTrue(true);
    }
}