Giter Site home page Giter Site logo

Guice configuration error about testng HOT 4 CLOSED

testng-team avatar testng-team commented on May 20, 2024
Guice configuration error

from testng.

Comments (4)

cbeust avatar cbeust commented on May 20, 2024

Could you include your test file as well, so I can reproduce exactly what you are seeing?

Thanks.

from testng.

cbeust avatar cbeust commented on May 20, 2024

One more thing: the stack trace is showing RemoteTestNG, which is only used by the Eclipse plug-in. How are you invoking TestNG exactly?

from testng.

Hapi avatar Hapi commented on May 20, 2024

Here is the main class:
package com.hapiware.test;

public class tester
{
    public static void main(String[] args)
    {
        System.out.println(add(1, 3));

    }
    public static int add(int a, int b)
    {
        return a + b;
    }
}

And here is the test class:
package com.hapiware.test;

import org.testng.annotations.Test;

public class TesterTest
{
    @Test
    public void test()
    {
        tester.add(1, 2);
    }
}

Notice

Exactly the same result can be achieved by using maven: mvn clean test

The result is then something like this:

...-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running TestSuite
org.apache.maven.surefire.booter.SurefireExecutionException: Guice configuration errors:

1) Error at org.testng.internal.Configuration.m_configurable(Configuration.java:54):
 Binding to org.testng.IConfigurable not found. No bindings to that type were found.

2) Error at org.testng.internal.Configuration.m_hookable(Configuration.java:44):
 Binding to org.testng.IHookable not found. No bindings to that type were found.

3) Error at org.testng.internal.Configuration.m_objectFactory(Configuration.java:10):
 Binding to org.testng.IObjectFactory not found. No bindings to that type were found.

4) Error at org.testng.internal.annotations.JDK15AnnotationFinder.m_transformer(JDK15AnnotationFinder.java:51):
 Binding to org.testng.IAnnotationTransformer not found. No bindings to that type were found.

4 error[s]; nested exception is com.google.inject.CreationException: Guice configuration errors:

1) Error at org.testng.internal.Configuration.m_configurable(Configuration.java:54):
 Binding to org.testng.IConfigurable not found. No bindings to that type were found.

2) Error at org.testng.internal.Configuration.m_hookable(Configuration.java:44):
 Binding to org.testng.IHookable not found. No bindings to that type were found.

3) Error at org.testng.internal.Configuration.m_objectFactory(Configuration.java:10):
 Binding to org.testng.IObjectFactory not found. No bindings to that type were found.

4) Error at org.testng.internal.annotations.JDK15AnnotationFinder.m_transformer(JDK15AnnotationFinder.java:51):
 Binding to org.testng.IAnnotationTransformer not found. No bindings to that type were found.

4 error[s]
com.google.inject.CreationException: Guice configuration errors:

1) Error at org.testng.internal.Configuration.m_configurable(Configuration.java:54):
 Binding to org.testng.IConfigurable not found. No bindings to that type were found.

2) Error at org.testng.internal.Configuration.m_hookable(Configuration.java:44):
 Binding to org.testng.IHookable not found. No bindings to that type were found.

3) Error at org.testng.internal.Configuration.m_objectFactory(Configuration.java:10):
 Binding to org.testng.IObjectFactory not found. No bindings to that type were found.

4) Error at org.testng.internal.annotations.JDK15AnnotationFinder.m_transformer(JDK15AnnotationFinder.java:51):
 Binding to org.testng.IAnnotationTransformer not found. No bindings to that type were found.

4 error[s]
        at com.google.inject.BinderImpl.createInjector(BinderImpl.java:277)
        at com.google.inject.Guice.createInjector(Guice.java:79)
        at com.google.inject.Guice.createInjector(Guice.java:53)
        at com.google.inject.Guice.createInjector(Guice.java:43)
        at org.testng.TestNG.initializeInjector(TestNG.java:787)
        at org.testng.TestNG.initializeCommandLineSuites(TestNG.java:720)
        at org.testng.TestNG.run(TestNG.java:796)
        at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:62)
        at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:141)
        at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
        at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] There are test failures.
...

from testng.

Hapi avatar Hapi commented on May 20, 2024

Forgot to add Eclipse commands. The procedure was:

  1. Cmd-Shift-F11 (Run Last Launched)
  2. Select TestNG, if asked

Then later on, Cmd-Shift-F11

I have built up the Eclipse environment by using Maven: mvn eclipse:clean eclipse:eclipse and then using Import... command from Eclipse.

from testng.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.