How do I create an executable jar for my JUnit 5 test class without maven/gradle/etc.?
If I try Eclipse Junit Class -> Export -> Java -> Runnable Jar the jar file produced will not run, it says main method is needed. However, the testRunner examples I've found online are all for JUnit4 and have compatibility issues with JUnit 5.
Related
I want to build jar files when all test cases pass and when 1 test case fails then not build jar files.
Please help me config
I use java8,junit5,junit jupiter 5.8.2,junit platform 1.8.2
When I used the main method it return an error message.
Is it possible to run Taurus and converted it to JMX file using the main() method?
or It's compulsory to use JUnit and its annotation in my selenium script when it runs using Taurus tools and then want to convert to jmx.
All supported modules are listed under Selenium Executor page of Taurus user manual.
selenium is a virtual executor, the "real" executors are:
JUnit (Java)
TestNG (Java)
Apiritif (Python)
PyTest (Python)
RSpec (Ruby)
Mocha (JavaScript)
NUnit (C#)
xUnit (C#)
In your case you need to comply with JUnit executor features and limitations, to wit Taurus will only look for methods which are properly annotated which is not the case for main()
If you cannot or don't want to refactor your existing Selenium scripts code you can just set them to use BlazeMeter Proxy Recorder as the proxy for the browser (by the way this is exactly what is Taurus doing under the hood of Proxy2JMX Converter module
i have a MacBook Pro and have downloaded java version 1.8 and selenium also. But im unable to find JUnit. Can i get the command to check the location of my JUnit. I have tried using a code to check whether JUnit is installed and the output is successful.
JUnit is not part of the standard JDK content; same for selenium.
Thus: you have to do something to pull the JUnit jar to your system. Either by downloading it manually yourself; or by using a build system like Maven or Gradle that can take care about resolving "dependencies" and downloading required artifacts automatically for you.
But in order to locate jar files on your system, you can simply turn to find command, like:
find / -type f -name "*.jar"
which should list you JAR files existing in your file system. You can read here about this and other tools that help you find files in your file system using the command line.
I receive the error java.lang.NoClassDefFoundError: org.codehaus.jackson.map.ObjectMapper even after adding the Jackson jar files. In Android Studio?
Also tried a few links. Namely this, which did not help.
Edit:
After some research I discovered the root of the error. The dynamo-geo.jar library that is provided by Amazon is inherently flawed in that it refers to some sort of outdated Jackson version. Upon looking in I can see that the class that is called geoJsonMapper refers to a deprecated version of ObjectMapper from the old 1.x.x versions of Jackson. I opened source code from dynamo-geo.jar here and I edited the ObjectMapper import from the outdated version to import com.fasterxml.jackson.databind.ObjectMapper;.
Now the issue I have is I am not sure if there is a way to compile a JAR file in Android Studio? In order to get the newly updated library into my other Android Studio project?
EDIT:
Solution - read this.
If you are using Jackson 2 then you will want to import com.fasterxml.jackson.databind.ObjectMapper instead of org.codehaus.jackson.map.ObjectMapper. You may also have a mix of Jackson 1 and Jackson 2 JAR files in your classpath.
You should be able to fork dynamodb-geo, make your changes, and use Maven to package the new JAR file (run the command mvn clean package). The new JAR file would be located in /dynamodb-geo/target/.
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
How to run Junit testcases from command line?
I've run my JUnit tests using maven before. Now I'm packaging all my source code into a JAR file, and want to run it using a java command. How can I do that? Note that there is no main class in my code.
You need to make sure the classpath contains
Your JAR
The JUnit JAR
You can set the class path by using the -cp flag to the java command. Then you can use junit.textui.TestRunner to run the tests.
If you're using Linux (note the use of : as the path separator between jars)
java -cp /path/to/my.jar:/path/to/junit.jar junit.textui.TestRunner com.mypackage.MyClassWithUnitTests
If you're using Windows (note the use of ; as the path separator between jars)
java -cp /path/to/my.jar;/path/to/junit.jar junit.textui.TestRunner com.mypackage.MyClassWithUnitTests