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

Add NUnit templates #93

Merged
merged 9 commits into from Sep 21, 2020
Merged

Add NUnit templates #93

merged 9 commits into from Sep 21, 2020

Conversation

halex2005
Copy link
Contributor

Hi!

In this PR I've cleaned up and adopted NUnit project templates from https://github.com/nunit/dotnet-new-nunit.

In second commit I've also adopted NUnit item templates. Is it suitable place for item templates? (if no, I could just drop second commit or move it to place where it would be suitable).

@pavelhorak, @kendrahavens, @ManishJayaswal, @nohwnd

Copy link
Collaborator

@AbhitejJohn AbhitejJohn left a comment

Choose a reason for hiding this comment

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

I'm assuming the contents of the templates are the same as what was already shipped from a different repo. Also not sure if the item template packaging/authoring needs any changes.

@halex2005
Copy link
Contributor Author

halex2005 commented Jul 16, 2020

@AbhitejJohn , contents of the templates were changed a little (template.json mostly). It were divided to 2.1, 3.0, 3.1 and 5.0 packages (in https://github.com/nunit/dotnet-new-nunit all templates were in one nuget package).
Important changes: groupIdentity and identity has been changed.

Should I return groupIndentity and identity to values like in https://github.com/nunit/dotnet-new-nunit ?

Therefore I assume that we must replace bundled nunit templates in dotnet/installer (like dotnet/installer#7169) with Microsoft.DotNet.Test.ProjectTemplates.3.0 and remove reference to https://www.nuget.org/packages/NUnit3.DotNetNew.Template/ package from installer.

@nohwnd
Copy link
Member

nohwnd commented Jul 24, 2020

@halex2005 yes, it should changed so they get automatically updated by this https://github.com/dotnet/installer/blob/470e5fb08b1834c0cab85397173bf990423a95bb/eng/Version.Details.xml#L74 when we produce a newer version.

@halex2005
Copy link
Contributor Author

halex2005 commented Aug 4, 2020

@halex2005 yes, it should changed so they get automatically updated by this https://github.com/dotnet/installer/blob/470e5fb08b1834c0cab85397173bf990423a95bb/eng/Version.Details.xml#L74 when we produce a newer version.

@nohwnd , I've changed groupIdentity and identity back, but identity still is not NUnit3.DotNetNew.Template.CSharp, but NUnit3.DotNetNew.Template.CSharp.{version} where version is 2.1, 3.0, 3.1 and 5.0.

I think this may require to execute dotnet new -u NUnit3.DotNetNew.Template during installation of .NET Core SDK. What do you think?

@nohwnd
Copy link
Member

nohwnd commented Aug 10, 2020

@nohwnd Jakub Jares FTE , I've changed groupIdentity and identity back, but identity still is not NUnit3.DotNetNew.Template.CSharp, but NUnit3.DotNetNew.Template.CSharp.{version} where version is 2.1, 3.0, 3.1 and 5.0.

I think this may require to execute dotnet new -u NUnit3.DotNetNew.Template during installation of .NET Core SDK. What do you think?

I will need to have a look on this once our internal build pipeline works, gimme some time please. 🙂

@nohwnd
Copy link
Member

nohwnd commented Aug 20, 2020

Pipeline works, will have a look at this, this week and finally get it merged :)

@pavelhorak
Copy link
Member

@nohwnd, @jmarolf can you please complete the review?

@nohwnd
Copy link
Member

nohwnd commented Sep 21, 2020

I reviewed it some time ago, I just never got to finishing it up, and validating that it actually works when inserted into dotnet installer.

@nohwnd
Copy link
Member

nohwnd commented Sep 21, 2020

Merging into installer for net6.0 will be much easier to fix it when we have the changes there.

@nohwnd nohwnd merged commit 579d159 into dotnet:master Sep 21, 2020
@nohwnd
Copy link
Member

nohwnd commented Jan 21, 2021

@halex2005 the nunit templates are now propagating to net6.0, including the item template and author info. (Some output is shortened. )

C:\t\nunit1> dotnet --version
6.0.100-alpha.1.21071.3

C:\t> mkcd nunit1

    Directory: C:\t

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d----          21/01/2021    15:55                nunit1


C:\t\nunit1> dotnet new nunit
The template "NUnit 3 Test Project" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on C:\t\nunit1\nunit1.csproj...
  Determining projects to restore...
  Restored C:\t\nunit1\nunit1.csproj (in 313 ms).
Restore succeeded.

C:\t\nunit1> cat .\nunit1.csproj
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>

    <IsPackable>false</IsPackable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
    <PackageReference Include="NUnit" Version="3.12.0" />
    <PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
    <PackageReference Include="coverlet.collector" Version="1.3.0" />
  </ItemGroup>

</Project>


C:\t\nunit1> dotnet new nunit-test -n MyTestFixture -o .
The template "NUnit 3 Test Item" was created successfully.

Processing post-creation actions...
Description: Opens created test fixture class in the editor
Manual instructions:

C:\t\nunit1> cat .\MyTestFixture.cs
using NUnit.Framework;

namespace Tests
{
    public class MyTestFixture
    {
[        ....cut... ]
    }
}
C:\t\nunit1> dotnet new --list nunit
Invalid input switch:
  nunit
Run dotnet new --help for usage information.
C:\t\nunit1> dotnet new nunit --help
Usage: new [options]

Options:
[        ....cut... ]


NUnit 3 Test Project (C#)
Author: Aleksei Kharlov aka halex2005 (codeofclimber.ru)
Description: A project that contains NUnit tests that can run on .NET Core on Windows, Linux and macOS
Options:
  [        ....cut... ]

C:\t\nunit1> dotnet new nunit-test --help
Usage: new [options]

Options:
 [        ....cut... ]


NUnit 3 Test Item (C#)
Author: Aleksei Kharlov aka halex2005 (codeofclimber.ru)
Description: A item that contains NUnit tests
    (No Parameters)

@halex2005 halex2005 deleted the nunit-templates branch January 28, 2021 14:03
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.

None yet

5 participants