Discussion:
[Cucumber] "TestRunner.initializationError » NoClassDefFound "
(too old to reply)
t***@gmail.com
2018-07-19 15:14:34 UTC
Permalink
Hi All -

I have set up a skeleton cucumber project in Intellij, that works, and want
to ultimately have it run in Jenkins.

But i want to test a "Light API". So through structure->modules i add the
jar to the project and put the Jar file in to "Resources" folder.

I have one function *TestAPI* that initialises the API. I have put this
file in main/java/com.example/example.java. if i, temporarily create a
main function and execute the
eg *TestAPI() *function through the intellij IDE the project executes the
TestAPI() successfully.

public static void main(String[] args) {

*TestAPI()* }



Of course i don't want a main. so i remove it.

I want to ultimately call it from a step definition function initiated from
a cucumber feature file step.

But first... set up test runner.

I also want to run it from command line. So i set up test runner.

After a couple of efforts i get test runner working smoothly. (not calling
*TestAPI()* yet )

using "mvn test"


But i am getting "TestRunner.initializationError » NoClassDefFound " for
the API.

It only occurs for a particular function call.

When i comment out the function it does not complain.

How would i best discover the cause of this problem ?

Thanks in advance.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Thomas Sundberg
2018-07-30 06:54:26 UTC
Permalink
Post by t***@gmail.com
Hi All -
I have set up a skeleton cucumber project in Intellij, that works, and want to ultimately have it run in Jenkins.
But i want to test a "Light API". So through structure->modules i add the jar to the project and put the Jar file in to "Resources" folder.
I have one function TestAPI that initialises the API. I have put this file in main/java/com.example/example.java. if i, temporarily create a main function and execute the
eg TestAPI() function through the intellij IDE the project executes the TestAPI() successfully.
public static void main(String[] args) {
TestAPI()
}
Of course i don't want a main. so i remove it.
I want to ultimately call it from a step definition function initiated from a cucumber feature file step.
But first... set up test runner.
I also want to run it from command line. So i set up test runner.
After a couple of efforts i get test runner working smoothly. (not calling TestAPI() yet )
using "mvn test"
But i am getting "TestRunner.initializationError » NoClassDefFound " for the API.
You are missing a dependency.
Post by t***@gmail.com
It only occurs for a particular function call.
When i comment out the function it does not complain.
How would i best discover the cause of this problem ?
Look at the exception, it says which class it is missing. If you share
the stacktrace, we might be able to tell you the name of the missing
dependency.

The solution? Add the missing dependency, the missing jar, in your class path.

HTH
Thomas
Post by t***@gmail.com
Thanks in advance.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
For more options, visit https://groups.google.com/d/optout.
--
Thomas Sundberg
M. Sc. in Computer Science

Mobile: +46 70 767 33 15
Blog: http://www.thinkcode.se/blog
Twitter: @thomassundberg

Better software through faster feedback
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...