Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test Results Files by Directory #407

Closed
wants to merge 6 commits into from

Conversation

AmandaAdams
Copy link

Changes to allow for passing test results files by directory instead of a delimited list of files. Code as it stands is designed for either the list of files or the directory. If both are passed, the directory trumps the list.

@dirkrombauts
Copy link
Member

Thank you for your contribution! I will have time to look into it on Tuesday latest.

Copy link
Member

@dirkrombauts dirkrombauts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we change the argument list, or the meaning of an argument, we should also update the documentation. The documentation can be found in the https://github.com/picklesdoc/docs repository.

@@ -39,7 +39,23 @@ public void ReportOn(IConfiguration configuration, Action<string> writeToLog)
if (configuration.HasTestResults)
{
writeToLog($"Test Result Format : {configuration.TestResultsFormat}");
writeToLog($"Test Result File : {configuration.TestResultsFile.FullName}");
int result = 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can write this entire block much simpler using some linq expressions.

{
configuration.AddTestResultFiles(
this.fileSystem.DirectoryInfo.FromDirectoryName(
this.testResultsDirectory).EnumerateFiles("*.json", System.IO.SearchOption.AllDirectories));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This restricts the results directory argument to .json result files.

I think it would be better to use the link-results-file parameter and make it able to read a wildcard expression.

For example, the link-results-file parameter should be able to interpret c:\temp\tests\*.trx.

@@ -69,6 +69,7 @@ private static int Main(string[] args)
{
if (Log.IsFatalEnabled)
{
Log.Info(ex.StackTrace);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one I like.

{
exampleResult = this.results.GetExampleResult(scenarioOutline, exampleValues);
}
catch (Exception) { }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're swallowing an exception without handling it in any way. That's bad.

List<Feature> features = this.ReadResultsFile(fileInfo);
if (features == null)
{
Console.WriteLine("There was an issue with the results format for " + fileInfo.Name);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're writing to Console.WriteLine instead of using the Logging infrastructure.

}
catch (Exception e)
{
Log.Error("An exception occured in aligning results with the feature for : " +
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're blindly logging all exceptions but not taking appropriate action. Not good.

.Select(row => row.Result)
.Merge();
} catch (Exception e) {
Log.Error("An exception occured in aligning results with the feature for : " +
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again: you're blindly logging an exception but taking no appropriate action. You should at the very least rethrow the exception. You should also be more selective in which exceptions you catch.

@@ -16,6 +16,22 @@
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkProfile />
<PublishUrl>C:\Users\aadams\Documents\ADP\published_files\pickles\</PublishUrl>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need clickonce code in Pickles

@@ -41,6 +57,18 @@
<PropertyGroup>
<StartupObject>PicklesDoc.Pickles.CommandLine.Program</StartupObject>
</PropertyGroup>
<PropertyGroup>
<ManifestCertificateThumbprint>58C81F2E680EB86FABDBEE60F94068CFF0846BAC</ManifestCertificateThumbprint>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also don't need this clickonce code in pickles

@dirkrombauts
Copy link
Member

Thank you for continuing to spend time on this.

I am close to merging PR #435 which adds wildcard support for test result files. I hope to release a new version of Pickles tomorrow, and request you try your scenario with the new version.

I will not merge your pull request. I raised some questions in December (mainly about your code restricting the search to .json files) but you did not address those. Additionally, the error handling you added today is not up to scratch. I added some comments to individual lines.

@AmandaAdams
Copy link
Author

Yep, sorry about that. I actually forgot that this request was still open. I needed to add some quick and dirty error messaging to the project to essentially continue on error. I knew it wasn't ready to commit -- I do think you'd benefit from adding continue on error functionality though. The system as stands is pretty hard to use when dealing with large distributed teams and 100s if not 1000s of features.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants