Monday, May 27, 2013

Windows Batch File Not Executing

I use jenkins to automate my cucumber test automation. I use windows to execute the batch command in Jenkins

bundle install --path vendor
set test_env=test_server 
bundle exec cucumber features\regression\dashboard.feature

However, only the first line is executed by jenkins. It turns out that jenkins creates a .bat file for those above commands and jenkins calls the commands as

cmd \c call hudson.bat

And apparently the cmd "Call" command only works on the first command.

To fix the issue simply append the keyword "call" on every command.

The solution:
call bundle install --path vendor
set test_env=test_server
call bundle exec cucumber features\regression\dashboard.feature

Jenkins does not execute All Windows Batch Command

I use jenkins to automate my cucumber test automation. I use windows to execute the batch command in Jenkins

bundle install --path vendor
set test_env=test_server 
bundle exec cucumber features\regression\dashboard.feature

However, only the first line is executed by jenkins. It turns out that jenkins creates a .bat file for those above commands and jenkins calls the commands as

cmd \c call hudson.bat

And apparently the cmd "Call" command only works on the first command.

To fix the issue simply append the keyword "call" on every command.

The solution:
call bundle install --path vendor
set test_env=test_server
call bundle exec cucumber features\regression\dashboard.feature

Friday, May 24, 2013

Cannot run program sh in jenkins

Error from Jenkins console:

[cuke-test] $ sh -xe C:\Users\username\AppData\Local\Temp\4\hudson4066016990068916818.sh
The system cannot find the file specified
FATAL: command execution failed
java.io.IOException: Cannot run program "sh" (in directory "c:\jenkins\workspace\cuke-test"): CreateProcess error=2, The system cannot find the file specified
 at java.lang.ProcessBuilder.start(Unknown Source)
 at hudson.Proc$LocalProc.<init>(Proc.java:244)
 at hudson.Proc$LocalProc.<init>(Proc.java:216)
 at hudson.Launcher$LocalLauncher.launch(Launcher.java:763)
 at hudson.Launcher$ProcStarter.start(Launcher.java:353)
 at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:988)
 at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:955)
 at hudson.remoting.UserRequest.perform(UserRequest.java:118)
 at hudson.remoting.UserRequest.perform(UserRequest.java:48)
 at hudson.remoting.Request$2.run(Request.java:326)
 at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
 at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
 at java.util.concurrent.FutureTask.run(Unknown Source)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
 at hudson.remoting.Engine$1$1.run(Engine.java:58)
 at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
 at java.lang.ProcessImpl.create(Native Method)
 at java.lang.ProcessImpl.<init>(Unknown Source)
 at java.lang.ProcessImpl.start(Unknown Source)
 ... 17 more
Build step 'Execute shell' marked build as failure

Solution:
- It turns out that I copied a job from a linux slave and therefore the default build step that was used was "Execute shell". To fix the issue just change the "Execute shell" to "Execute Windows batch command"

Tuesday, May 7, 2013

Git Setup Remote Tracking Branch


Git global setup

git config --global user.name "Test User"
git config --global user.email "testuser@gmail.com"

Create Repository

mkdir testproject
cd testproject
git init
touch README
git add README
git commit -m 'first commit'
git remote add origin git@gitlab.testserver-123.testuser/testprojects.git
git push -u origin master

Existing Git Repo?

cd existing_git_repo
git remote add origin git@gitlab.testserver-123.testuser/testprojects.git
git push -u origin master

Friday, May 3, 2013

Capybara Check Select Options

To check Select options using Capybara

To choose the select option:

select('Morning', :from => 'Shift')

To check the value of the select options:

page.has_select?('Shift', :selected => 'Morning')




Thursday, March 28, 2013

Creating GIT branch and merge


--- to create:
git checkout master
$ git checkout -b new-branch
--- to merge
git commit -am "commit file in branch"
git checkout master
git merge new-branch

Tuesday, March 19, 2013

Resizing image to create thumbnail in MAC

to resize an image or images in a directory use the following command:

//to resize all of the images in a directory to 245x245 size
sips --resampleHeightWidth 245 245 *