how to run robot framework(autoit) test in jenkins? - jenkins

I have a robot file, written with autoit library. Using it for testing a 3rd party software installation in Windows 7.
If I run this robot file, a pop-up window will appear, from here I need to proceed with next steps of software installation. (Please NOTE : I know that , I can do silent installation here. But my job is to validate the pop-up window :( )
Now the problem is :
If I run this robot file from windows command prompt, using "pybot test.robot" command. its working as expected. But when I integrate this with jenkins, the pop-up window NOT appearing. I am getting the below error:
[Job to run RFW test] $ cmd /c call C:\Windows\TEMP\hudson8861333201655586740.bat
C:\Program Files (x86)\Jenkins\workspace\Job to run RFW test>pybot Software_install_testsuite.robot
==============================================================================
Software install testsuite
==============================================================================
TESTCASE1 : ID 1234 | FAIL |
**AutoItError: timeout on wait for activate window**
------------------------------------------------------------------------------
I have tried with "xshell", "power shell" and "Windows batch command" in ADD BUILD STEP in jenkins. But still I am seeing the same error.
From last two weeks I am trying to fix this. Any help on this is really appreciated.
Thanks.

Try to install vnc (e.g. ultravnc), run jenkins slave within this vnc session (don't use RDP connection), and then try to trigger test from jenkins.

Related

How to run Robot Framework/Sikuli test cases with Jenkins?

I am trying to run some automated tests for desktop apps. The code is written in Robot Framework and Sikuli. If I run them from command line, it is okay, but when I try it from Jenkins it is not.
Here is how I try to build in Jenkins
Here is the simple code:
Help
[Tags] help
Capture Screen
Click input_id
This is the result:
As you see it could not see my screen. What should I do to let the "Jenkins process" see my screen?
The issue was, that I installed Jenkins as a Windows service. After I installed via the jenkins.war file, it works.

MSBuild - Jenkins - Nuget integration

We are experiencing some weird behavior using Jenkins and MSBuild.
When manually typing into a command line to build a build.xml project:
msbuild build.xml /T:Package /P:PublishProfile=Test /P:Platform="AnyCPU"
/P:VisualStudioVersion=12.0
The build process works exactly as expected (build, packaging, etc.)
However, if I am using Jenkins to do exactly this - that is - open a command line and run this exact command, I get an error saying:
The command ""..\.nuget\NuGet.exe" install
"C:\Jenkins\jobs\.....\workspace\MYPROJECT\packages.config"
-source "" -NonInteractive -RequireConsent -solutionDir "..\ "" exited with code 1
Even if I am using the built-in jenkins plugin to run the command (regardless which parma combination I use), it still doesn't.
I know two of the following sounds like a solution, but they don't work:
Permissions! - My server always runs as admin.
Enabling package restoring on NuGet from VS - Already did!
Any idea will be great!!!
Here is the answer, it took a long time to solve, and thanks to #adarshr I came to realize the problem is because of the difference between the Jenkins runner's user (i.e the jenkins Service) and my user. To resolve this issue I've made Jenkins running as the same user and all good!
Step by step:
Go to Control Panel -> System and Security -> Administrative Tools
Click on the Services shortcut.
Right click on the Jenkins service and select Properties.
Navigate to the Log On tab.
Click on run as this user and fill in your credentials.
Restart Jenkins.
Works like a charm!

jenkins debugging with eclipse

I have built a new "Hello World" plugin for Jenkins and I was able to upload it onto Jenkins and it works successfully. I am now trying to make change to the plugin and debug it on Jenkins. I did this according to the instructions on this tutorial https://wiki.jenkins-ci.org/display/JENKINS/Plugin+tutorial
I tried this command:
mvnDebug hpi:run
and then start to debug from eclipse to the port 8000 which is the port that Jenkins opens up for debugging. The eclipse was able to connect to the correct port and I got the message which seems to be correct:
[info] Jenkins is fully up and running
It seems that everything went OK. Then I go to localhost:8080 to see the plugin but I found nothing there. Can anybody help me with this, please? Thanks.
Ok, about debugging Jenkins plugins, I know that there is a little amount of information. I can tell you how I debug:
Using the tutorial from https://wiki.jenkins-ci.org/display/JENKINS/Plugin+tutorial#Plugintutorial-DebuggingaPlugin
1. stop jenkins service
2. from cmd I run
set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8000,suspend=n
and
mvn hpi:run
Note: Build automatically must be unchecked in Eclipse. And after I run mvn hpi:run I try to connect Eclipse to the port using java remote ( or something like this).
The second method that I use is:
1. I installed maven plugin in eclipse
2. Create a run configuration as maven in eclipse
3. Stop jenkins server
4. Run the configuration
5. Access localhost:8080/jenkins
Sorry for not giving the exact steps but I have those configurations on my PC at work...
Also, in my opinion the second method is more stable. I use it frequently when I work with my plugin...

Robotium Tests not running on Jenkins but local

i try to integrate my Robotium Tests on our Jenkins Server. I implemented an android Test Project that based on our app Project. Everything works like a charm when i run the Tests on my local Machine on Windows out of Eclipse and also by calling from shell by call
'adb shell am instrument -w <our-package>/android.test.InstrumentationTestRunner'
So far, so good, but after i set up a build Job in Jenkins, let the Projects build by maven clean install sign etc. none of my tests will be proceeded. I also tried to call 'adb shell am instrument -w <our-package>/android.test.InstrumentationTestRunner' as shell command after the build step but also no result. The build ended up with just 2 Tests shown log below
[workspace] $ /bin/sh -xe /tmp/hudson3571502822112946903.sh
+ /home/jenkins/tools/android-sdk-linux/platform-tools/adb shell pm list instrumentation
instrumentation:com.android.emulator.connectivity.test/android.test.InstrumentationTestRunner (target=com.android.emulator.connectivity.test)
instrumentation:com.android.emulator.gps.test/android.test.InstrumentationTestRunner (target=com.android.emulator.gps.test)
instrumentation:com.zeppelin.zemos.test.addispo/android.test.InstrumentationTestRunner (target=com.zeppelin.zemos.addispo)
+ /home/jenkins/tools/android-sdk-linux/platform-tools/adb shell am instrument -w com.zeppelin.zemos.test.addispo/android.test.InstrumentationTestRunner
android.test.AndroidTestCase:.
android.test.LoaderTestCase:.
Test results for InstrumentationTestRunner=..
Time: 0.031
OK (2 tests)
Just the 2 Tests AndroidTestCase and LoaderTestCase are shown up and it seems that all of my other Testcases (i've implemented 11) are not processed by Jenkins.
I spent a long time googling around but found no solution for this. Could this be a ant Problem? I have Version 1.8 local and 1.6 on the Jenkins Server. Or is there another Problem i cannot see.....
Thanks a lot
You can try uninstalling the package from device/ emulator, using
"adb uninstall your_package"
Then, do a clean debug install again and then run the tests.

execute shell step skipped completely in jenkins

I can't seem to run a build execute shell step in Jenkins. I've worked with Hudson in the past on windows and I was able to create shell/batch steps without a problem but I seem to be be missing something here.
It's a fresh jenkins install and I go to "add build step", "execute shell" and enter "echo hi" in the command. I run the build and when I look in the console output, nothing happens.
I've also tried executing a test.sh file which also just echoes hi. I've tested this in both a linux install and an os X installed Jenkins server.
What am I missing in the configuration to run a shell script?
The console output shows that the shell script steps were skipped completely
Started by user admin
Finished: SUCCESS
It looks like Jenkins is not being able to redirect the output from the system. What version of Java are you using? If you're using OpenJDK, could you try with Sun Java/Sun JDK?
First test to try to check if anything is executing at all: add the following to your "Execute Shell"
#!/bin/bash
echo "HELLO WORLD" > /tmp/testfile
Run this and check if there is a /tmp/testfile in on your Linux system, and if it contains the HELLO WORLD text, it means your script is in fact executing.
Which version of Jenkins do you have?
The last good version that I can attest to (last one I know works well at least for us) is 1.447. If you're not using that one, would you be able to try with it?
Also, could you add #!/bin/sh or #!/bin/bash before echo hi on your "Execute Shell" for the Linux system and see if that works.
Also, try running a script using source /path/to/script and see if that works. The script should contain #!/bin/sh or #!/bin/bash as the first line, just to see if that makes a difference.
Note: none of this should be required, but is helpful just to get more information on what's going on. Couldn't fit all this into a comment. I'll update my answer based on your answers to the above, or delete if I can't get anything..
Putting this here for posterity.
I had a Jenkins project configured with Maven running clean test and a execute shell in the pre steps. The logs from Maven where not coming through and the script was not executing. Once I unchecked Build modules in parallel under the Maven build options my logs and scripts started working.
Make sure its in a location where Jenkins can see it, check permissions.

Resources