how can i use "|find" in robot frame work - robotframework

I want to know the status of the virtual machine
In Command Prompt by executing the below command
C:\Program Files\Oracle\VirtualBox>vboxmanage showvminfo Linux |find "State:"
I got output as
=>State: running (since 2020-09-30T06:00:01.824000000)
the same thing when I tried in robot framework(RIDE)
#${result}= Run process C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage showvminfo Linux |find "State:"
I am getting error as -
Syntax error: Invalid parameter '|find'
Can someone help how to use |find in robot framework.

Piping eg, using | character is shell feature. If you want to run shell commands or using features from it, you need to tell Run Process to run it inside a shell by adding shell=yes to your Run Process keyword.
This is documented in https://robotframework.org/robotframework/latest/libraries/Process.html#Process%20configuration and a section below it called Running processes in shell

Related

Error that says Rscript is not recognized as an internal or external command, operable program or batch file [duplicate]

shell_exec("Rscript C:\R\R-3.2.2\bin\code.R ");
This is the call to script.On calling the above script, the error occurs.
I am trying to call my R script from the above path but no output is being shown. While checking the error logs of PHP, it says 'Rscript' is not recognized as an internal or external command, operable program or batch file.' The script is working fine on the Rstudio but not running on the command line.
Add the Rscript path to your environment variables in Windows:
Go to Control Panel\System and Security\System and click Advanced System Settings, then environment variables, click on path in the lower box, edit, add "C:\R\R-3.2.2\bin"
Restart everything. Should be good to go. Then you should be able to do
exec('Rscript PATH/TO/my_code.R')
instead of typing the full path to Rscript. Won't need the path to your my_code.R script if your php file is in the same directory.
You need to set the proper path where your RScript.exe program is located.
exec ("\"C:\\R\\R-3.2.2\\bin\\Rscript.exe\"
C:\\My_work\\R_scripts\\my_code.R my_args";
#my_args only needed if you script take `args`as input to run
other way is you declare header in your r script (my_code.r)
#!/usr/bin/Rscript
and call it from command line
./my_code.r
If you are running it in Git Bash terminal, you could follow a revised version of the idea suggested by #user5249203: in the first line of your file my_code.R, type the following
#!/c/R/R-3.2.2/bin/Rscript.exe
I assumed that your path to Rscript.exe is the one listed above C:\R\R-3.2.2\bin. For anyone having a different path to Rscript.exe in Windows, just modify the path-to-Rscript accordingly. After this modification of your R code, you could run it in the Git Bash terminal using path-to-the-code/mycode.R. I have tested it on my pc.
I faced the same problem while using r the first time in VS Code, just after installing the language package (CRAN).
I restart the application and everything worked perfectly. I think restarting would work for you as well.

Karate Runner -> karate jar : Command line args settings issue

I am using Visual Studio code and Karate Runner plugin is installed. Using karate-config.js with standalone jar (karate.jar). I have tried to configure in karate runner settings in VS code for Karate Runner -> karate jar : Command line args as "java -Dkarate.config.dir=test/resources/ -cp karate.jar com.intuit.karate.Main" but it throws an exception like
Executing task: java -Dkarate.config.dir=test/resources/ -cp karate.jar com.intuit.karate.Main "d:\GitHub\KarateTestFramework\test\features\script\all_users.feature:9" <
Error: Could not find or load main class .config.dir=test.resources.
The terminal process "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -Command java -Dkarate.config.dir=test/resources/ -cp karate.jar com.intuit.karate.Main "d:\GitHub\KarateTestFramework\test\features\script\all_users.feature:9"" terminated with exit code: 1.
Terminal will be reused by tasks, press any key to close it.
Also, I have tried full path for -Dkarate.config.dir=D:/GitHub/KarateTestFramework/test/resources but didn't work either.
Please guide me to resolve this issue.
#ChandramohanRamabadran, I tried to replicate the issue on my system. I believe it's not a bug!
It's happening because your VisualStudio is using PowerShell instead of CMD. I believe you might have missed the step to change the default shell of VisualStudio after installing Karate. Try updating the default shell from PowerShell to CMD; then you should be good.
However, if you still want to use PowerShell, then update the command
java -Dkarate.config.dir=test/resources/ -cp karate.jar com.intuit.karate.Main
to
java `-Dkarate.config.dir`=test/resources/ -cp karate.jar com.intuit.karate.Main
More context over the issue:
PowerShell has a more standard rule to parse system-properties parameters which are different from CMD. In a PowerShell command, the parameter names always begin with a hyphen. The hyphen tells PowerShell that the item in the command is a parameter name.
Here, we are passing the parameter as -Dkarate.config.dir, PowerShell sights the parameter name-tag as -Dkarate and not -Dkarate.config.dir; hence the error.
This is a bug. Thanks for reporting it: https://github.com/intuit/karate/issues/1330
For now please find a workaround. Karate will look for karate-config.js in the current directory or the classpath. So if you change the command to something like this (please try variations) it should work
-cp 'karate.jar;test/resources/'
I have changed preferred terminal shell from Powershell to command as default for VS code and followed the below listed steps
Press Ctrl + Shift + P to show all commands.
Type shell in the displayed text box to filter the list.
Select Terminal: Select Default Shell .
You will be prompted to Select your preferred terminal shell, you can change this later in your settings or follow the same process as we do now.
I have changed the karate runner->karate jar:Command Line Args settings as java -Dkarate.config.dir=resources/ -cp karate.jar com.intuit.karate.Main
Now its working fine.

Rerun Failed test cases from output.xml using jython in robot/RIDE

I am using RIDE 1.3 using robotframework 2.8.7 running on Python 2.7.6. To execute my test I use jybot. The Jython version is Jython 2.5.3. I have an output XML generate from a previous run with failed cases. Now I need to selectively execute only the failed cases from the XML.
I have tried using the Command -R --rerunfailed [xml_path] by inserting it in the arguments tab of RIDE. But this command is unrecognised by the editor so I use -R [xml_path] instead which does not throw any errors.
Finally, when I start executing the suite I expect only the failed results from the suite to run but the entire suite runs as if the command has no effect. The suite from previous run and current run is same but the suite is large and output.xml generated is huge (~100 MB).
How can I execute only failed cases?

How to run Unix command from Oracle Forms

OS: UNIX Solaries, Oracle Application Server 10g
To run shell script from Oracle Forms, I used the following host('/bin/bash /u01/compile.sh') and it works well
Now, I need to run unix command something like
host('mv form1.fmx FORM1.FMX') but it's not working
I tried to append the command mv form1.fmx FORM1.FMX' to the compile.sh shell script but also it's not working although the rest lines of the shell script is running well
The solution is to just add the full path of the mv command and it worked well, as follow
/bin/mv /u01/oracle/runtime/test/form1.fmx /u01/oracle/runtime/test/FORM1.FMX
In case anyone else encounters the same problem, the cause is that Forms process creates a subprocess to execute host() command, and that subprocess inherits environment variables of the parent process, which are derived from default.env (or other env file as defined in server config). There is a PATH variable defined in that file, but it doesn't contain usual /bin or /usr/bin, so the commands will not execute unless full path is specified.
The solution is to set the correct PATH variable either in the executed script (via export PATH=$PATH:...) or in default.env. I set it in the script, since, knowing Oracle, there's no guarantee that modifying default.env won't break something.

Ksh Script automatically calling another script in /usr/bin

I am executing a ksh script named abs.ksh located at /app/fao.... which connects to a server,
But the server is receiving a script named "ksh" which is present in /usr/bin...
I am not calling any script called ksh in abs.ksh(sorry cannot paste the code).
Also this happens only when the script is run in debug mode.
In non debug mode it works fine.
Can anyone give me a hint of what might be happening here.
In a standard "classic" Unix environment there may be multiple shells. E.g. 'sh' the original Bourne shell, 'ksh' - the Korn shell, csh - the C shell, bash, tcsh etc. etc.. A user login will have the default shell set per login.
The #! at the start of an executable script is an instruction to interpret & run the subsequent text with the name of the program following the '#!'.
E.g. run this with perl
#!/bin/perl
<.. perl stuff ..>
So yes #!/usr/bin/ksh - will run the script with the command interpreter (shell) at that location.
Need more info. wrt how you run in debug mode. I.e. are you typing 'ksh -x ...' or 'sh -x' - if so where is that on your search path. E.g. 'whence ksh' - maybe you're running with a different shell in debug mode.
Also which os is this ?

Resources