TestNG ant task throws exception: ava.util.ServiceConfigurationError: org. testng.ITestNGListener: Provider test.serviceloader.TmpSuiteListener not found

254 views
Skip to first unread message

Pavel Gouchtchine

unread,
Jul 5, 2014, 11:00:03 PM7/5/14
to testn...@googlegroups.com
On attempt to run testng tests from ant build file, TestNG throws exception - see below.
Please help!!

An example project that includes my build.xml and suite file is here:
https://drive.google.com/file/d/0B2Oj5VU5ZPzDQloycTFzX0hVTVk/edit?usp=sharing
(it contains testng 6.8 library i am using)
The command line to execute:

c:\java\verifyanttestng>
c:\java\verifyanttestng>ant -DsuiteName=TestCalculator.xml
Buildfile: c:\java\verifyanttestng\build.xml

init:
   [delete] Deleting directory c:\java\verifyanttestng\bin
    [mkdir] Created dir: c:\java\verifyanttestng\bin
   [delete] Deleting directory c:\java\verifyanttestng\test-output
    [mkdir] Created dir: c:\java\verifyanttestng\test-output

compile:
    [javac] Compiling 2 source files to c:\java\verifyanttestng\bin

Run_Suite:
     [echo] ${browser}
     [echo] ./test_suites/TestCalculator.xml
   [testng] Exception in thread "main" java.util.ServiceConfigurationError: org.
testng.ITestNGListener: Provider test.serviceloader.TmpSuiteListener not found
   [testng]     at java.util.ServiceLoader.fail(ServiceLoader.java:239)
   [testng]     at java.util.ServiceLoader.access$300(ServiceLoader.java:185)
   [testng]     at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoade
r.java:372)
   [testng]     at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:
404)
   [testng]     at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
   [testng]     at org.testng.TestNG.addServiceLoaderListeners(TestNG.java:956)
   [testng]     at org.testng.TestNG.initializeConfiguration(TestNG.java:891)
   [testng]     at org.testng.TestNG.run(TestNG.java:1005)
   [testng]     at org.testng.TestNG.privateMain(TestNG.java:1338)
   [testng]     at org.testng.TestNG.main(TestNG.java:1307)

BUILD FAILED
c:\java\verifyanttestng\build.xml:43: The tests failed.

Total time: 2 seconds

c:\java\verifyanttestng>

Neeraj Lad

unread,
Oct 30, 2014, 12:11:24 PM10/30/14
to testn...@googlegroups.com
HI ,

Any update on this error ?

following is my ant file

i have replaced  "< and >" to "[ and ]"


[project name="TestNGTest" default="run" basedir="."]
[!-- Define [testng] task --]
  [taskdef name="testng" classname="org.testng.TestNGAntTask"]
    [classpath]
      [pathelement location="lib/testng-6.8/testng-6.8.jar"/]
    [/classpath]
  [/taskdef]
   [property name="testdir" location="build" /]
   [property name="srcdir" location="src" /]
   [property name="libdir" location="lib" /]
   [property name="full-compile" value="true" /]
   [path id="classpath.base"/]
   [path id="classpath.build"]
       [fileset dir="${libdir}"]
         [include name="**/*.jar" /]
      [/fileset]
      [pathelement location="${testdir}" /]
      [pathelement location="${srcdir}" /]
      [path refid="classpath.base" /]
   [/path]
   [target name="clean" ]
      [delete verbose="${full-compile}"]
         [fileset dir="${testdir}" includes="**/*.class" /]
      [/delete]
   [/target]
   [target name="compile" depends="clean"]
      [javac srcdir="${srcdir}" destdir="${testdir}" 
         verbose="${full-compile}"]
         [classpath refid="classpath.build"/]
      [/javac]
   [/target]
   [target name="run" depends="compile"]
[testng outputdir="${testdir}" classpathref="classpath.build"] 
      [xmlfileset dir="./suites" includes="AllFlows.xml"/] 
    [/testng]
   [/target]
[/project]

run:
   [testng] Exception in thread "main" java.util.ServiceConfigurationError: org.testng.ITestNGListener: Provider test.serviceloader.TmpSuiteListener not found
   [testng]     at java.util.ServiceLoader.fail(Unknown Source)
   [testng]     at java.util.ServiceLoader.access$300(Unknown Source)
   [testng]     at java.util.ServiceLoader$LazyIterator.next(Unknown Source)
   [testng]     at java.util.ServiceLoader$1.next(Unknown Source)
   [testng]     at org.testng.TestNG.addServiceLoaderListeners(TestNG.java:961)
   [testng]     at org.testng.TestNG.initializeConfiguration(TestNG.java:896)
   [testng]     at org.testng.TestNG.run(TestNG.java:1031)
   [testng]     at org.testng.TestNG.privateMain(TestNG.java:1364)
   [testng]     at org.testng.TestNG.main(TestNG.java:1333)
   [testng] The tests failed.

BUILD SUCCESSFUL
Total time: 4 seconds

I tried your sharing build file but got same problem. 

Please let me know if any solution you found.

Thanks

Scott Babcock

unread,
Dec 14, 2016, 1:33:43 PM12/14/16
to testng-dev
From the exception, it appears that you've declared a listener (test.serviceloader.TmpSuiteListener) to be loaded by the ServiceLoader, but the specified listener class isn't on the class path. Check out http://testng.org/doc/documentation-main.html#listeners-service-loader for details.
Reply all
Reply to author
Forward
0 new messages