When I'm trying to do activiti BPM when i'm running "Generate a unit test" i'm getting error in Java file that created when running unit test
i'm using eclipse juno and fedora OS
You need to add junit library to your project.
properties->java build path->libraries->add libary
Related
I am running into a weird error with my IntelliJ setup for Scala. When I try to run any Unit Test for my project, I get the below error.
scalac: Output directory not specified for ...
From Maven, I am able to successfully run the tests. No issues there.
To ensure my Scala setup is correct, I created a simple HelloWorld scala project and I am able to successfully add a unit test and run it from IntelliJ.
I am running into this error only for my project repo that I downloaded from Git. Any suggestions on how I can identify what I am missing in the setup?
Things I tried so far:
I ensured that my Java and Maven version in IntelliJ matches what I have on my Mac
I tried deleting the .idea folder, "invalidate caches and restart". No luck after any of these.
➜ ~ mvn -version
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /Users/syncmaster/.asdf/installs/maven/3.6.3
Java version: 11.0.14.1, vendor: Azul Systems, Inc., runtime: /Users/syncmaster/.asdf/installs/java/zulu-11.54.25/zulu-11.jdk/Contents/Home
My unit tests work inside Eclipse (Run with Junit Test) when my pom.xml is setup to use SpringBoot 2.3.12.RELEASE. When I try to use 2.5.2 they fail like this:
java.lang.NoSuchMethodError: org.springframework.test.context.TestContext.computeAttribute
They work when you do a Maven build inside or outside Eclipse.
Anybody else having these kind of issues?
Oh boy! It the things you overlook that get you. I had some project dependencies to other projects on my Eclipse project that I had not upgraded yet. As soon as I upgraded everything, all my unit tests started to run. My apologies.
Bob
Currently we are using JUnit4 testing framework in our project with SAP Commerce 1808, and the unit tests are working fine.
However, we would like to start using JUnit5 framework. After importing respective JUnit5 libraries and compiling the unit test, I have run the command in the console:
ant unittests -Dtestclasses.packages=<package_name> -Dtestclasses.suppress.junit.tenant=true
ant was not able to find the test class and showed the output in the console:
...
[echo] No tests found!
Which is surprising, because I have used the annotation #UnitTest before the class name:
#UnitTest
public class ClassName{
...
}
Trying to find an answer, I searched for examples of unit tests in SAP Commerce documentation: https://help.sap.com/viewer/d0224eca81e249cb821f2cdf45a82ace/1808/en-US/aae25ecb74ab4bd69cc5270ffd455459.html and noticed that all the unit test examples use only JUnit4 framework.
Also I checked Hybris out-of-the-box code and also saw that only JUnit4 framework is used there.
So the question is: how to run JUnit5 tests in SAP Commerce 1808?
I'm trying to add JUnit5 support in my Eclipse RCP application. It almost works, because for now I can:
Use Maven to build whole application and run tests with Tycho
Run single JUnit5 tests (creating run configuration on specific class) in
Eclipse
Run single JUnit5 tests in Run as JUnit Plug-in test mode in Eclipse
Run multiple JUnit5 tests in Run as JUnit test mode in Eclipse
What I'm trying to achieve now is to be able to run whole sets of test classes in plug-in test mode. For JUnit4-based plug-ins I could simply right-click on whole package or even whole plug-in and invoke Run As -> JUnit Plug-in test.
When I do the same operation on JUnit5 tests I get an error: No tests found with test runner 'JUnit 5'.
My current configuration for such plug-ins looks as follows:
According to official instructions in MANIFEST.FM I have Import-Package dependencies:
org.junit.jupiter.api,
org.junit.jupiter.params,
org.junit.jupiter.params.provider
and org.junit as Require-Bundle dependency
In order to run tests in Eclipse IDE I've also added JUnit 5 library to Java Build Path of the plugin. I coudn't add JUnit 5 runner dependencies to MANIFEST.FM instead, because of conflict with Tycho.
As per this example provided in the groovy site, I have tried to implement an exactly same XML RPC Server on my eclipse.
import groovy.net.xmlrpc.*
import java.net.ServerSocket
def server = new XMLRPCServer()
server.echo = {return it}
def serverSocket = new ServerSocket( 9004 )
server.startServer(serverSocket)
The above code will launch a server on 9004 only when I run from groovy console. When I run the same from Eclipse it fails to run and shows the following exception
Caught: groovy.lang.MissingPropertyException: No such property: echo for class: groovy.net.xmlrpc.XMLRPCServer
at GServer.run(GServer.groovy:7)
Perhaps it is unable to understand the dynamic addition of the new property called echo but I am not sure. How can I fix this?
PS : I am running
Eclipse Galileo 3.5
Groovy eclipse plugin installed
Groovy xml rpc jar is on the classpath
There were some bugs with the launcher in the Groovy-Eclipse that ran on Eclipse 3.5. I'd recommend that you upgrade to Groovy-Eclipse 2.6.0 on Eclipse 3.7. I'd bet that your problem would go away.