1
votes

I have been trying to start selenium tests with browsers, not headless. I have my code in SVN and this should be build by Jenkins. Jenkins is on Linux.

Has anyone ever tried that or do you know what steps I should take? I am going through tutorials available on the internet but none of them work for me.

My current error is:

java.io.IOException: Cannot run program "cmd" (in directory "/var/lib/jenkins/jobs/Tests/workspace"): error=2, No such file or directory at java.lang.ProcessBuilder.start(ProcessBuilder.java:1047) at hudson.Proc$LocalProc.(Proc.java:240) at hudson.Proc$LocalProc.(Proc.java:212) at hudson.Launcher$LocalLauncher.launch(Launcher.java:815) at hudson.Launcher$ProcStarter.start(Launcher.java:381) at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:95) at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:64) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779) at hudson.model.Build$BuildExecution.build(Build.java:205) at hudson.model.Build$BuildExecution.doRun(Build.java:162) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534) at hudson.model.Run.execute(Run.java:1720) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:410) Caused by: java.io.IOException: error=2, No such file or directory at java.lang.UNIXProcess.forkAndExec(Native Method) at java.lang.UNIXProcess.(UNIXProcess.java:187) at java.lang.ProcessImpl.start(ProcessImpl.java:130) at java.lang.ProcessBuilder.start(ProcessBuilder.java:1028) ... 15 more Build step 'Execute Windows batch command' marked build as failure Finished: FAILURE

When built without error, the workspace was only updated:

Building in workspace /var/lib/jenkins/jobs/Tests/workspace
Updating http://XX.XX.XXX.XX/resp/extend/Tests/EO at revision '2016-07-04T14:34:05.110 +0200'
At revision 5536

No changes for http://XX.XX.XXX.XX/resp/extend/Tests/EO since the previous build
Finished: SUCCESS

If you need any further details, let me know ...

UPDATE:

[workspace] $ /bin/sh -xe /tmp/hudson8771943326851387647.sh
+ ./script.sh
/tmp/hudson8771943326851387647.sh: line 2: ./script.sh: Permission denied
Build step 'Execute shell' marked build as failure
Finished: FAILURE

I have changed the windows command to shell command. The shell command is:

./script.sh

I think that the script inside the file i wrong, but does the error I have now mean that the script is wrong or does it reflect to something else? I do not know hwy we have "permission denied" - I have all the right in jenkins.

And this is my script.sh file content:

#!/bin/bash

function run_test {

    echo "=== run Selenium tests in Jenkins ==="
    ssh root@$1 "/src/test/java/mainTest/MainOrderTest start"

}

fi

I have no knowledge on shell command and I have not found any command that would run this program.

1
To run on jenkins to may need to go for headless testing using HTMl unit driver or phantom js.Umesh Kumar
@AutoMater that's definitely not true. Jenkins can run non-headless browsers just fine if the guest OS is also not running headless.Mobrockers

1 Answers

3
votes

You are trying to run windows batch scripts on Linux hence the error.

Two options : 1. Either convert your build scripts to shell and use "execute shell" to call your shell scripts in jenkins 2. Add a windows slave which will build your windows batch script