I'm attempting to use karate version 1.0.1 to test command line options. So far, for the most part, everything is working and it is amazingly powerful and simple :)
But, I'm running into an issue. The problem I have is that I need to test some command line scripts where the output may vary depending on OS.
Here is an example of a scenario I'm attempting to use
Feature: Test commands from the tool file
Scenario: Verify contents of tool help menu options
* if(windows) command('tool --help')
* if(!windows) command("./tool --help")
Then match exit == 0
And match out contains "Usage: tool --[command]"
And match out contains "no argument [Run in Jetty]"
And match out contains "--migrate [migrate tool database using database settings]"
And match out contains "-p xxxx [listening port to be used (replace xxxx with a port number)]"
And match out contains "--help [display this message]"
And match out contains "example: tool --migrate"
# Some commands are OS specific
# How to accomplish this??? What's below doesn't work
* if(!windows) match out contains "--status [check the status of the tool process and port]"
* if(windows) match out contains "--install [install tool as a windows service]"
* if(windows) match out contains "--remove [remove tool service]"
The non-OS specific commands at the top all execute and verify output as expected. However I cannot use the if statement along with the match statement. Is there some way to do this?
I have seen some other posts about conditional matching within if statements, but I think this scenario may be different. I haven't yet figured out how to accomplish something like this using karate. Unless I were to have separate feature/package for the different OS's.
Thanks in advance for any help that can be provided.