How to trigger a cucumber command from bamboo?
Asked by Ivy Zhou:

I used Jenkins for cucumber feature files execution previously. Now I'm going to use bamboo. But the same shell command which works in Jenkins does not work in bamboo.

Could anybody help?

Bamboo version: 6.9

Repository: Bitbucket server

Command example: cucumber BROWSER=firefox MODE=local SCREENSHOT=on HIGHLIGHT=off -f json -o test_result.json --tags @CASE=TEST

Error: cucumber: command not found

Many thanks.


Answers:
author: Rafael Pinto Sperafico
body: Hi [@Ivy Zhou](/t5/user/viewprofilepage/user-id/3563184) ,

When running a build / deployment in Bamboo, this will be executed against an Agent, in which, can be a Local, Remote, EC2 agent.

Based on the error you have mentioned, it seems the Bamboo Agent in which the build / deployment was executed against does not have "cucumber" installed.

Here is an example for PROJ-PLAN-JOB1-1

```
simple 04-Mar-2019 14:51:42 Build Project - Plan - Default Job #1 (PROJ-PLAN-JOB1-1) started building on agent Default Agent
simple 04-Mar-2019 14:51:42 
simple 04-Mar-2019 14:51:42 Build working directory is /var/atlassian/application-data/bamboo/xml-data/build-dir/PROJ-PLAN-JOB1
```

The 1st line will inform you where the build (JOB1) is being executed against, in this case against Bamboo Server as a Default Agent.

The 2nd line will inform you the agent's location (e.g ip address, dns...) Since is it executing against Bamboo Server, this information is not provided.

The 3rd line indicates under which directory the build (JOB) is being executed against.

Based on the Bamboo version (v6.9) you have provided, I am assuming you are running a Script task to issue the command:

```
cucumber BROWSER=firefox MODE=local SCREENSHOT=on HIGHLIGHT=off -f json -o test_result.json --tags @CASE=TEST
```

Please, go the server where the build (JOB) was executed against.

Navigate to the Build Working Directory as in example in 3rd line from Terminal and issue the cucumber command. This will confirm whether or not cucumber is installed on that server. At the same time, *confirm if the user running Bamboo on that server has enough permissions to run cucumber*.

Last but not least, make sure *cucumber* is available to the *PATH* in which the user running Bamboo has access to. For that, simply run a new build in Bamboo under the same Agent where the cucumber error was thrown and add a Script task as the first thing to be executed with the following:

* on Linux

```
echo $PATH
```

* on Windows

```
echo %PATH%
```

Please, feel free to disable all other tasks as they not required for this testing purpose.

After the build (JOB) gets executed, check the build log, reviewing if the PATH is correct - *cucumber is available to the user running Bamboo Agent*. If changes need to be made to the PATH, it is mandatory restarting the Bamboo Agent to changes can be applied.

Kind regards,  
Rafael


author: swapnil meshram
body: Hello Team,

can you please help in add scripts task to execute cucumber framework, I dont know where need to add the Maven command to RUN the test suits after build.

Locally i am able to RUN the API test using below command to RUN it :

```
-e test -Dhttps.protocols=TLSv1.2 -DenvType=demouat -Dtrust_all_cert=true.

suspecting tose command need to add in scripts 
```


author: Ivy Zhou
body: Dear Rafael,

Thanks very much for you kindly answer.

Yes i can trigger the cucumber command after add the ruby path to PATH.

Thanks again for your time and effort.

Have a nice day!

Best Regards,

Ivy Zhou


Tags: cucumber