Issue running TestNG from Jenkins - selenium

When trying to trigger a Selenium test thru Jenkins, I face the following issue:
Error: Could not find or load main class org.testng.TestNG
Build step 'Execute shell' marked build as failure
Finished: FAILURE
I do have the testNG jar file in my classpath which is shown below:
My Execute Shell command looks like the following:
set classpath="${WORKSPACE}/bin;${WORKSPACE}/lib/*"
chmod a+x ${WORKSPACE}/lib/*.jar
java -cp "${WORKSPACE}/out/production/Test;${WORKSPACE}/lib/*" org.testng.TestNG ${WORKSPACE}/TestNG.xml
This project is triggered from Bitbucket and is locally built on IntelliJ.
Any help here, would be appreciated.

It looks you are trying to run on a Linux OS.
On Linux, the classpath separator is : and not ;.
http://daviditnotes.blogspot.fr/2007/12/java-classpath-separator.html
Try:
set classpath="${WORKSPACE}/bin:${WORKSPACE}/lib/*"
chmod a+x ${WORKSPACE}/lib/*.jar
java -cp "${WORKSPACE}/out/production/Test:${WORKSPACE}/lib/*" org.testng.TestNG ${WORKSPACE}/TestNG.xml

Related

Running Karate from karate.jar with cucumber reports

I want to run my karate tests using karate.jar.
Currently am using maven for execution. I have a runner class which handles cucumber reporting as mentioned in karate documentation.
java -jar karate.jar -T 5 -t ~#ignore -o /mydirectory/all.feature
When I change the test execution as above, is there a way I can get cucumber reports generated same as I was getting for maven?
my current execution is like this: mvn clean test -Dtest=TestRunner.java -Dkarate.env=UAT
when running the features using karate standalone jar, cucumber-html-reports will be generated default on target directory inside you karate.jar's directory
look for target\cucumber-html-reports in the directory where you have you karate.jar
java -jar karate.jar -T 5 -t ~#ignore /mydirectory/all.feature
karate also provides a -o flag in which the provided directory will be used to save reports
java -jar karate.jar -T 5 -t ~#ignore -o /mydirectory /mydirectory/all.feature

How to use -Dinstallation.host= in intelliJ tomcat configuration without command line

I am using mvn for build and deploy my code in tomcat. I am using command for build clean install -DskipTests -DskipJangarooApp -pl :studio-webapp -am -T 4C where studio-webapp is my module name.
And after build i use tomcat:run command like this :
tomcat7:run -Dinstallation.host=192.168.252.100
where 192.168.252.100 is my host machine IP. This process is running well.
But the problem is when I change any java class in my IntelliJ I again run buil command then run. And its taking so much time. So that I want to apply tomcat configuration in IntelliJ but i am not able to find any option of "-Dinstallation.host" in this screen

Haxe: openfl test works but not lime build

I'm in the process of moving all my projects to individual modules in IntelliJ rather than having one module in the entire git repo, and my IntelliJ builds stopped working. I notice it uses lime builds even though my module is set to openfl (and always has as far as I know)
openfl test flash -debug
this works
lime build GassyRickAstley.xml flash -debug -verbose
this does not. Full gist of both -v
Lime Command-Line Tools (2.9.1)
Initializing project...
Using project file: GassyRickAstley.xml
Warning: Could not read HXCPP config: /Users/booboo/.hxcpp_config.xml
Using target platform: FLASH
Running command: UPDATE
- Embedding asset: removed for brevity
- Copying template file: removed for brevity
Running command: BUILD
- Running command: haxe -main ApplicationMain -cp /usr/local/lib/haxe/lib/flixel/git -D flixel=4.3.0 -cp /usr/local/lib/haxe/lib/openfl/3,6,1 -D openfl=3.6.1 -cp /usr/local/lib/haxe/lib/lime/2,9,1 -D lime=2.9.1 -cp /usr/local/lib/haxe/lib/actuate/1,8,7 -D actuate=1.8.7 -cp /usr/local/lib/haxe/lib/ash/1,5,4/src -D ash=1.5.4 -cp source -cp lib -cp /usr/local/lib/haxe/lib/openfl/3,6,1/extern -cp ../Krakel/source -cp ../../lib/HxAssert/src -D native-trace -D HXCPP_QUIET -D openfl-next -D tools=2.9.1 -D flash-use-stage -D no-compilation -D openfl-flash -D verbose=1 -D web --macro flixel.system.macros.FlxDefines.run() -swf-lib export/flash/obj/assets.swf -swf-version 11.8 -swf export/flash/bin/GassyRickAstley.swf -cp export/flash/haxe -debug
georges-mbp:Gassy Rick Astley booboo$
It doesn't seem like anything went wrong, but I'm pretty shit with analyzing terminal output.
For now I can just build manually, but not having breakpoints is gonna get pretty lame, pretty fast. Any help is appreciated.
Bonus question. When I run/test the project in open fl and close the game's window the active terminal process never ends. I have to close the terminal, reopen and cd my directory again. is there a way around this?
It looks like it may have worked. openfl test flash is similar to running openfl build flash && openfl run flash, which in turn should behave practically the same as lime build flash && lime run flash.
I think your lime build flash command is working properly, but is exiting because the application has finished building. If you use lime test flash instead, it might build-and-run for you, as the other command does?

Invoking Jython without Weblogic's WLST

I'm using an AIX machine which has Weblogic 9.21 installed and it also has jython as part of its installation (WLST).
Is there a way to run jython code without having to initialize the WLST first?
I have the following jars too if they bring in any ideas:
['.', '/opt/weblogic921/weblogic92/common/lib/jython.jar', '/opt/weblogic921/weblogic92/common/lib/config.jar', '/opt/weblogic921/weblogic92/common/lib/config.jar', '/opt/weblogic921/weblogic92/server/lib/weblogic.jar', '/opt/weblogic921/weblogic92/common/wlst/modules/jython-modules.jar/Lib', '/opt/weblogic921/weblogic92/common/wlst', '/opt/weblogic921/weblogic92/common/wlst/lib', '/opt/weblogic921/weblogic92/common/wlst/modules']
Right now I'm invoking the jython code using:
java -cp /opt/weblogic921/weblogic92/server/lib/weblogic.jar weblogic.WLST file.py
Paste below code in a shell script say jythonExec.sh and use it
Example Usage : /bin/bash jythonExec.sh file.py
#!/bin/bash
jythonJarLoc=/opt/weblogic921/weblogic92/common/lib/jython.jar
javaLoc=/usr/bin/java
pythonCacheDir=/tmp/pythonCacheDir
if [ ! -f ${jythonJarLoc} ]; then
jythonJarLoc=/opt/weblogic921/weblogic92/server/lib/weblogic.jar
fi
${javaLoc} -cp ${jythonJarLoc} -Dpython.cachedir=${pythonCacheDir} org.python.util.jython $#

Maven:Output Build log

In Ant we have the provision to send the Build details to a log file by specifying the log file as a param while invoking the Ant build like ant -l $BUILDLOG
Do we have a similar functionality in Maven ?
I added > mvn_build_log.txt to the end of my command to output the mvn build output.
Not in maven 2. But it was added in maven 3 (currently in alpha) in the same form. e.g. mvn -l $BUILDLOG.