display options for subcommands using PicoCLI - picocli

I am using PicoCLI v4.0.0-beta-1b. I am using different subcommands linked from a parent command. The parent command's optional parameters get displayed when I launch the CLI but not for the subcommands. The subcommands only appears underneath commands (but with no options).
How does one go about to ensure that the options for subcommands appear in the CLI as well?
Options:
-a, --autocomplete Generate sample autocomplete
-h, --help Display this help message.
-v, --verbose Verbose mode. Helpful for troubleshooting.
-V, --version Show version info and exit.
Commands:
abc
def

By default, picocli only shows an overview of a command's subcommands, and no details. This follows the conventions of other command suites like git. The idea is that end users can always get details for another subcommand by asking for help for that specific subcommand, like git commit --help, or git help commit.
While this is a useful default, if that's not what you want, picocli usage help is highly customizable.
The picocli usage message has the following sections:
header heading
header
synopsis heading
synopsis
description heading
description
positional parameter list heading
positional parameter list
option list heading
option list
command list heading
command list
exit code list heading (since 4.0)
exit code list (since 4.0)
footer heading
footer
Each section has its own IHelpSectionRenderer, and you can change the usage help by removing, reordering or replacing these help section renderers.
An example to get you started is here:
https://github.com/remkop/picocli/blob/master/picocli-examples/src/main/java/picocli/examples/customhelp/ShowAll.java
The above example has a custom IHelpSectionRenderer for the command list, to show the full hierarchy of commands, subcommands, and sub-subcommands, etc. You may want to do something similar but show the options of the subcommands instead.
You will need to familiarize yourself with some details of the picocli Help API, like TextTable, Layout, IOptionRenderer, etc.

Related

How to add Info to custom keyword Log

In Robot Framework, when you create a custom keyword using the *** Keyword *** section of .robot file, is there a way to print an INFO message in the log file? I've tried using BuiltIn.Log keyword, but it creates a new keyword section where the INFO is written.
I want to get INFO in custom keyword this way:
Info in Keyword execution
But currently, my only option is: Info inside BuiltIn.Log definition
Is there a way to add INFO directly to my custom keyword without using Python API?
Did you try Log to console Typing text ${User} into text field 'username' like this?
To my knowledge what you are attempting, is unfortunately not doable. This way of embedding messages can be done by the robot.logger or Python's logging api - More info in the Robot Framework User Guide
However in addition to using the Log keyword, you may alleviate the need by first adding a documentation string on your keywords - the first line is always shown in the Documentation section of the keyword. Additionally by enabling Trace on the log file you'll get at least the Arguments and Return values shown on each keyword.
The Documentation is added with the [Documentation] tag similar to
Custom Keyword
[Documentation] This string is shown completely until I leave at least
... One empty row.
...
... This is shown only in the library documentation file.
And logging modes are changed with a launch option -L or --loglevel, to enable Trace mode, simply add the option when launching your robot.
robot -t TestName -s SuiteName -L TRACE .\Path\to\Tests

How can enforce `qmake` to contain `ProvisioningStyle` $ `DevelopmentTeam` fields in `project.pbxproj`?

I am using Qmake command line to build my app for iOS and I am struggling to sign my app with xcodebuild because the MyApp.xcodeproj/project.pbxproj that qmake is generating does not the contain the following fields at all
ProvisioningStyle
DevelopmentTeam
How can enforce qmake to contain ProvisioningStyle $ DevelopmentTeam fields in project.pbxproj?
I dont need to have any certain value to be set into the 2 fields. Only, need the fields to be present in appropriate places in project.pbxproj. Opening & MyApp.xcodeproj in Xcode UI IDE & just checking-unchecking the Automatically manage signing option under Project>General settings adds the fields into project.pbxproj. How can I get qmake to add them for me?
As you know, I answered the DevelopmentTeam detail on this SO thread:
Qt for iOS: code signing is required
You commented that you tried the same pattern for PROVISISIONING_STYLE but did you try ProvisioningStyle? I'm just a bit unclear what you did and what the results were.

How to change reports or output saving location in robot framework from RIDE

When I run test cases from RIDE the reports are saved in the below path.
C:\Windows\Temp\RIDExf4xla.d
I want save reports in specific path. Can I do this from RIDE? Is there any setting to change the reports location?
Can anyone please suggest the way to do it.
Thanks
Look at the --outputdir command within the Robot Framework Documentation:
Here is what I use:
--outputdir C:/Robot/AutomationLogs/etc/etc --timestampoutputs
You use this one liner on the "Arguments" Field, right on the top of RIDE within the run tab.
From Wamans comment you can add formats to the end of the argument, to also change the dir name dynamically. See the 2nd answer within that SO question. This should be enough for you to get what you're asking for.
There is no way to set this within a UI.
Just set it by pasting that argument option within the "Arguments" Field at the top.
use below code in command line
C:\Tests\> robot -d C:\Test_results Test.robot

how to run multiple suites in RIDE

I created multiple suites, say 'StarterKit Registration','White SIM Registration', 'Add VAS' ..etc.,
I want to run all these suites together through RIDE and I want to run in my own order i.e not in alphabatical order.
Can any one help on this to achieve.
Thanks
Sarada
You can either use prefixes to suite names as mentioned before.
Or
as you said, Use -A arguments file which will have list of your test suites
Agr_sample.txt
------------------
StarterKit Registration
White SIM Registration
Add VAS
... so on
then pass the same argument file while triggering the pybot command as
pybot -A Agr_sample.txt
It will trigger the suites in the order they are mentioned in the file.
Hope it helps! and thanks for telling me about argument file :)

Robot Framework HTML Report Customisation

I need to customize the HTML report generated at the end of test execution.
Few things I require are:
Remove the table - Statistics by Tags as I am not using any tags
Add the version number for the SUT in the summary section of the report.
What solutions are there for this? I tried to change the robot code and also tried to work on the output.xml. But nothing worked.
There is no facility provided by robot to customize the report and log files, as far as adding or removing sections is concerned. You have two options:
write your own report generator that converts output.xml into a format you like, or
create a fork of the robot framework source code and make the modifications there.
For the case of putting the version number for the SUT in the summary section of the report, you can add that with the --metadata command line option:
pybot --meta "SUT version: 1.2.3" ...
That will add the version to the summary section. You can also use the Documentation setting or the --doc command line option to put information that will appear in the report summary.
If you aren't using tags, you should! Those are one of the best features of the framework. You can create tags during a test run, so you could have your tests define a "sut version" tag and set it to the version of the system being tested.

Resources