Skip to content

Add PSxUnit runner - #2574

Closed
Chunqing Chen (chunqingchen) wants to merge 5 commits into
PowerShell:masterfrom
chunqingchen:master
Closed

Chunqing Chen (chunqingchen) wants to merge 5 commits into
PowerShell:masterfrom
chunqingchen:master

Conversation

@chunqingchen

Copy link
Copy Markdown
Contributor
  • We need a runner that runs across platforms and compatible with .net core
  • Some of the code are from dotnet-test-xunit as it supports .net core and is a xunit runner, I modify the file to compatible running PS tests and add classification

@msftclas

Hi Chunqing Chen (@chunqingchen), I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!

In order for us to evaluate and accept your PR, we ask that you sign a contribution license agreement. It's all electronic and will take just minutes. I promise there's no faxing. https://cla.microsoft.com.

TTYL, MSBOT;

@daxian-dbw Dongbo Wang (daxian-dbw) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hi Chunqing Chen (@chunqingchen), there are a few issues with your PR:

  1. You need to sign the CLA agreement
  2. Your first 2 commits show changes that are already merged: 0908547. And your third commit is a merge commit. Please rebase your working branch and push again.
  3. Please fix the Travis CI failure.

@SteveL-MSFT

Copy link
Copy Markdown
Member

Chunqing Chen (@chunqingchen) you need to join the Microsoft GitHub org

@chunqingchen

Copy link
Copy Markdown
Contributor Author

Dongbo Wang (@daxian-dbw)
cla signed
redundant commits removed
all checks passed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

assemblyFilename [](start = 50, length = 16)

Check for null or empty string.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

corrected

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The same Path.Combine() is done twice. It should be something like:

var runnerJson = Path.Combine(pathWithAssemblyName, $"{assemblyName}.xunit.runner.json")

if(File.Exists(runnerJson)
{
return File.OpenRead(runnerJson);
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

corrected

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

File.OpenRead [](start = 27, length = 13)

This can throw exceptions. We should catch and fail gracefully.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

corrected. Although I don't try to catch most of the exceptions and want to throw them as they are

Comment thread test/tools/PSxUnit/Program.cs Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Add ///

style comments for all public types and properties.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

corrected

Comment thread test/tools/PSxUnit/Program.cs Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

//Console.ReadKey(); [](start = 12, length = 20)

Remove unnecessary commented lines.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

corrected

Comment thread test/tools/PSxUnit/Program.cs Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

use named parameters.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

corrected

Comment thread test/tools/PSxUnit/Program.cs Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe this can be moved before the block which checks for "Skip". So if the testcase does not match the filter then we dont need to check if it is skipped.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

corrected.

Comment thread test/tools/PSxUnit/Program.cs Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

(".\result.xml" [](start = 44, length = 16)

Result file name should not be hardcoded but be accepted as a parameter.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

corrected

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this intentional?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this intentional?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Uncommented.

Comment thread test/tools/PSxUnit/CommandLineOption.cs Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Mix use of tabs and spaces.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

corrected

Comment thread test/tools/PSxUnit/CommandLine.cs Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please break this into smaller functions. Some code might be reusable and it will become much more readable.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this is actually from the dotnet-test-xunit project so i would just leave it as is

@adityapatwardhan

Copy link
Copy Markdown
Member

🕐

@chunqingchen

Copy link
Copy Markdown
Contributor Author

Aditya Patwardhan (@adityapatwardhan) the comments are resolved.

@chunqingchen

Copy link
Copy Markdown
Contributor Author

Jason Shirk (@lzybkr) Hi Jason, Aditya has approved the comments, can this be merged?

@lzybkr

Copy link
Copy Markdown
Contributor

Reassigned to Dongbo Wang (@daxian-dbw) - he'll want to look at this as part of moving to msbuild based dotnet cli.

@chunqingchen

Copy link
Copy Markdown
Contributor Author

Dongbo Wang (@daxian-dbw) Hi Dongbo, Aditya has approved the comments, can this be merged?

@daxian-dbw

Copy link
Copy Markdown
Member

Chunqing Chen (@chunqingchen) Sorry that I didn't get a chance to quickly go through this PR. Will do it.

@daxian-dbw

Copy link
Copy Markdown
Member

Steve Lee (@SteveL-MSFT) This PR contains code from XUnit. I just want to double check, is there a concern about checking in third party source code to our repository?

@SteveL-MSFT

Copy link
Copy Markdown
Member

Dongbo Wang (@daxian-dbw) yes, we need to adhere to their licensing

@SteveL-MSFT

Copy link
Copy Markdown
Member

Chunqing Chen (@chunqingchen) it looks like we're just taking some of their code without modification? can we have this be a runtime dependency so that xunit is already available?

@daxian-dbw

Copy link
Copy Markdown
Member

I'm closing this PR for following 2 reasons:

  1. After moving to netcoreapp2.0, we will refactor our code to get rid of powershell assembly load context, and thus we won't need a special runner to host powershell.
  2. We have moved to MSBuild, and this PR needs to be re-worked to be built with MSBuild.

@iSazonov Ilya (iSazonov) removed the Review - Needed The PR is being reviewed label Apr 20, 2017
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.

9 participants