autorest icon indicating copy to clipboard operation
autorest copied to clipboard

Test coverage gap for AutoRest.exe help scenario

Open tbombach opened this issue 10 years ago • 2 comments

When a user runs AutoRest.exe without any parameters, they will see the help documentation. This scenario is tested during release activities, but is not covered by any test right now.

tbombach avatar May 13 '16 17:05 tbombach

More context:

When there are no parameters to AutoRest.exe, the call stack is as such:

[Generator constructor]
[External Code]
AutoRest.Core.dll!Microsoft.Rest.Generator.Extensibility.ExtensionsLoader.LoadTypeFromAssembly<Microsoft.Rest.Generator.CodeGenerator>(System.Collections.Generic.IDictionary<string, Microsoft.Rest.Generator.Extensibility.AutoRestProviderConfiguration> section, string key, Microsoft.Rest.Generator.Settings settings) Line 194   C#
AutoRest.exe!Microsoft.Rest.Generator.Cli.HelpGenerator.Generate(string template, Microsoft.Rest.Generator.Settings settings) Line 158  C#
AutoRest.exe!Microsoft.Rest.Generator.Cli.Program.Main(string[] args) Line 31   C#

It instantiates each generator and passes a Settings object to each one to give it a chance to report its own name and description in the help output. This assumes that each generator can handle a Settings object that may not be able to generate code in that given language (e.g. some languages require a non-null Settings.Namespace string). The Settings object comes from Settings.Create(args), with args being the arguments to AutoRest.exe. If a generator breaks this assumption (e.g. not checking for a null or empty Settings.Namespace before using it), it will throw when showing help.

We should add a unit test that verifies that HelpGenerator.Generate() does not throw when it's given the same parameters that are passed when AutoRest.exe is started without parameters.

tbombach avatar May 26 '16 17:05 tbombach

Howdy!

In our planning for driving towards a stable '1.0' release, I'm marking this issue as 'deferred' :zzz: and we're going to review it during the post-1.0 planning cycle.

It's not to say that we're not going to work on it, or that this isn't not important, but at the moment, we're picking and choosing the stuff we must do before 1.0. :horse_racing: :horse_racing: :horse_racing:

We'll make sure we pick this back up at that point. :tada:

fearthecowboy avatar Aug 04 '16 17:08 fearthecowboy