TestNG + Yaml

290 views
Skip to first unread message

Сергей Пирогов

unread,
Mar 18, 2016, 10:53:13 AM3/18/16
to testng-users
Hi,

I have a small question about using TestNG latest version with Yaml config.

I've created vanila TestNg with Gradle, but while running test I am getting exception. could you please show an example of integration TestNg with Yaml?

My gradle test task is:

test {
    useTestNG {
        suites 'src/main/resources/TestNG.yaml'
    }
    testLogging.exceptionFormat = "full"
}

My yaml config:


name: TestNG
tests:
   - name: Regression2
     includedGroups: [ nopackage ]
     classes:
      - com.testng.TestNG


Exception:

org.gradle.api.internal.tasks.testing.TestSuiteExecutionException: Could not complete execution for process 'Gradle Test Executor 2'.
	at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:59)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
	at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
	at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
	at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
	at com.sun.proxy.$Proxy2.stop(Unknown Source)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.stop(TestWorker.java:115)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
	at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
	at org.gradle.messaging.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:360)
	at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoClassDefFoundError: org/yaml/snakeyaml/constructor/Constructor
	at org.testng.internal.YamlParser.parse(YamlParser.java:16)
	at org.testng.internal.YamlParser.parse(YamlParser.java:10)
	at org.testng.xml.Parser.parse(Parser.java:172)
	at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:305)
	at org.testng.TestNG.run(TestNG.java:1036)
	at org.gradle.api.internal.tasks.testing.testng.TestNGTestClassProcessor.stop(TestNGTestClassProcessor.java:115)
	at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:57)
	... 21 more
Caused by: java.lang.ClassNotFoundException: org.yaml.snakeyaml.constructor.Constructor


吴亭

unread,
Mar 18, 2016, 5:38:00 PM3/18/16
to testng...@googlegroups.com
Try check your dependency if you have this in your classpath:
org.yaml:snakeyaml:1.15

Br,
Tim

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

Krishnan Mahadevan

unread,
Mar 20, 2016, 11:57:03 PM3/20/16
to testng...@googlegroups.com
Tim,
If the OP is using gradle for dependency management, shouldn't the snakeyaml dependencies automatically be made available in the classpath [ similar to how it happens in the case of Maven ? ]



Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/
Reply all
Reply to author
Forward
0 new messages