CE_
CE_

Reputation: 1118

Launch a .bat from Jenkins does not work

This is the .bat file :

start cmd.exe /k "C:\Users\etudes.ext46\AppData\Local\Android\sdk1\tools\emulator.exe -avd ff &"
ping 127.0.0.1 -n 60 > nul
start cmd.exe /k "adb shell input keyevent 82"
start cmd.exe /k "node "C:\Program Files\Appium\node_modules\appium\bin\appium.js" -a 127.0.0.1 -p 4723 &"
ping 127.0.0.1 -n 30 > nul
C:\Users\etudes.ext46\Downloads\NUnit-2.6.4\NUnit-2.6.4\bin\nunit-console.exe C:\Users\etudes.ext46\Downloads\NUnit-2.6.4\NUnit-2.6.4\bin\apk\UnitTestProject1.dll
start cmd.exe /k "taskkill /F /IM emulator-x86.exe"
start cmd.exe /k "taskkill /F /IM node.exe"
start cmd.exe /k "taskkill /F /IM cmd.exe"

When i run it manually, it works pretty well (emulate an android device an use Appium with Nunit tests).

But when I try to launch the exact same .bat from Jenkins it doesn't work

Errors and Failures:
1) TearDown Error : AppiumSample.ASSI2.AssistanceV2
   SetUp : System.InvalidOperationException : A new session could not be created. (Original error: Could not find a connected Android device.) (33)
TearDown : System.NullReferenceException : Object reference not set to an instance of an object.

The complete logs are here : http://img.prntscr.com/img?url=http://i.imgur.com/KsrEJiT.png

How can I make this .bat work with Jenkins?

Upvotes: 1

Views: 749

Answers (1)

CE_
CE_

Reputation: 1118

The solution was to add the option -no-window when launching the emulator

start cmd.exe /k "C:\path\emulator.exe -avd ff -no-window &"

instead of

start cmd.exe /k "C:\path\emulator.exe -avd ff &"

Upvotes: 1

Related Questions