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

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.

Related

is there a way to ignore a scenario within the command java -cp karate.ja:?

I'm using a .jar, along with docker and a .sh to do the execution.
I use this command in .sh
java -cp karate.jar:./cases com.intuit.karate.Main "$#"
and I would like to use ~#ignore to not run some scenarios, is it possible?
Karate in version 1.1.0 onwards automatically ignores any scenario tagged as #ignore. Please refer the docs: https://github.com/karatelabs/karate#special-tags

I can not call riscv64-unknown-elf-gcc in archlinux

After installed the toolchain of xv6 needed on archlinux, following Tools Used in 6.S081 , I run the riscv64-unknown-elf-gcc --version, but my command line shows zsh: command not found: riscv64-unknown-elf-gcc, how can I do next?
In my archlinux, use the riscv64-linux-gnu-gcc command to compile, in macOS I use riscv64-unknown-elf-gcc, maybe try the first one, Or try typing risc and then pressing the tab key, maybe the shell will help you complete the rest of the command

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

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

"The term '-Command' is not recognized as the name of a cmdlet" when trying to execute an inline command in PowerShell Core on Ubuntu

I'm trying to execute an inline command in PowerShell Core (6.2.3) on Ubuntu.
This throws an error:
pwsh -Command "Write-Host 'Hello, world'"
-Command : The term '-Command' is not recognized as the name of a cmdlet, function, script file, or operable program.
I installed PowerShell as a dotnet core global tool if that makes a difference.
Pass the command without a parameter name:
pwsh "Write-Host 'Hello, world'"
Microsoft's documentation shows that the parameter name is required, so maybe this is a quirk of installing pwsh as a dotnet core tool.

flyway sbt placeholder substitution not working

Using Flyway 2.3 on Windows, same result from command prompt and within cygwin. Production env is Linux, but haven't been able to test there yet.
My SQL file has the line:
alter table person add ${new_col} text;
I added the following to my build.sbt, based on what I saw on the the flyway sbt doc page:
flywayPlaceholders := Map(
"new_col" -> "temp_name"
)
When I run
> sbt flywayMigrate
I get this:
com.googlecode.flyway.core.api.FlywayException: No value provided for placeholder expressions: ${new_col}. Check your configuration!
Under cygwin it does work if I specify the substitution on the command line:
> sbt flywayMigrate -Dflyway.placeholders.new_col=temp_name
Command line plaveholder substitution doesn't work in Windows command prompt, but I suspect that's a different issue as none of my -D options are respected there.
I'm new to both sbt and Flyway, so I'm hoping this is something simple, but I couldn't find anything helpful by googling. thanks in advance for any help
The flywayPlaceholders in build.sbt are currently by the commandline configuration.
This is a bug in Flyway.
I created a pull request.

Resources