Ask a Question

Running bash command in ReadyAPI groovy steps

Senior Member

Running bash command in ReadyAPI groovy steps

Hello Team,


I have created a groovy step in my test case to execute the below bash command. When I try to run this command, then I get a below error from execution. I have tried the number of different things to make the bash command work but I didn't found any solution so far.


OS: mac 

bash command:

def process = "aws-azure-login".execute()
process.waitFor() "Output: " + process.text "Exit code: " + process.exitValue()



ERROR: An error occurred [Cannot run program "brew": error=2, No such file or directory], see error log for details


Also, just to make sure I have created 'bashCommand.groovy' class file in my visual studio and that is working fine but not sure why the same thing is not working in ReadyAPI groovy steps. So far I have noticed that when I pass any other command like the below examples then they are working fine.


Working bash cmd:

bash --version

java --version 


Can anyone please help me to understand what I am doing wrong?


Please note that my E2E test needed more than one bash command to run so I can't use '.sh' option because those commands needed to run in different intervals. 


Note: After installing ReadyAPI in my Mac machine, I have not added any additional files to the package folder (bin or ext). I hope that is not an issue.  


Please advise if you have anything suggestion for me to try?




Community Hero

Please provide the absolute path of the "aws-azure-login" command in the blow
def process = "aws-azure-login".execute()

Frequent Contributor

@sam2009 most likely error is your command line. you can paste your command line here if no concern or you can try a simple command to try. for example:  def cmd = "ls -la".execute()


// Here is an example (on windows) to call command (or shell)
// you can check it with zsh / bash command on your Mac

try {
    def cmd = "cmd /c cd /d \"${toolDir}\" & tool.exe \"${outputDir}\" \"${logDir}\" "
    def output = cmd.execute()
    def out = new StringBuffer()
    def err = new StringBuffer()
    output.waitForProcessOutput(out, err)
    if (output.exitValue()) {
    } else {
} catch(Exception e) {"Cancelled!!! => $e")





SmartBear Alumni (Retired)

Thanks a lot, Aaron and Rao!


@sam2009 did you find the replies helpful?

Sonya Mihaljova
Community and Education Specialist

Showing results for 
Search instead for 
Did you mean: