Skip to content

Commit

Permalink
Adding SystemTest. Closes #8
Browse files Browse the repository at this point in the history
  • Loading branch information
brendanconnolly committed Jan 15, 2018
1 parent 6da7d99 commit 8e656f6
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 5 deletions.
31 changes: 31 additions & 0 deletions src/Xunit.Categories/SystemTestAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Text;
using Xunit.Abstractions;
using Xunit.Sdk;

namespace Xunit.Categories
{

[TraitDiscoverer(SystemTestDiscoverer.DiscovererTypeName, DiscovererUtil.AssemblyName)]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
public class SystemTestAttribute : Attribute, ITraitAttribute
{
public SystemTestAttribute(string id)
{
this.Id = id;
}

public SystemTestAttribute(long id)
{
this.Id = id.ToString();
}

public SystemTestAttribute()
{

}

public string Id { get; private set; }
}
}
25 changes: 25 additions & 0 deletions src/Xunit.Categories/SystemTestDiscoverer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Text;
using Xunit.Abstractions;
using Xunit.Sdk;

namespace Xunit.Categories
{
public class SystemTestDiscoverer : ITraitDiscoverer
{
internal const string DiscovererTypeName = DiscovererUtil.AssemblyName + "." + nameof(SystemTestDiscoverer);

public IEnumerable<KeyValuePair<string, string>> GetTraits(IAttributeInfo traitAttribute)
{
var bugId = traitAttribute.GetNamedArgument<string>("Id");


yield return new KeyValuePair<string, string>("Category", "SystemTest");

if (!string.IsNullOrWhiteSpace(bugId))
yield return new KeyValuePair<string, string>("SystemTest", bugId);

}
}
}
9 changes: 5 additions & 4 deletions src/Xunit.Categories/Xunit.Categories.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
<Authors>Brendan Connolly</Authors>
<Company>Brendan Connolly</Company>
<Description>Friendly Traits for Xunit</Description>
<Version>2.0.2</Version>
<FileVersion>2.0.2</FileVersion>
<Version>2.0.3</Version>
<FileVersion>2.0.3</FileVersion>
<PackageId>xunit.categories</PackageId>
<PackageVersion>2.0.2.1</PackageVersion>
<PackageReleaseNotes> Update project to netstandard1.1, include new categories</PackageReleaseNotes>
<PackageVersion>2.0.3</PackageVersion>
<PackageReleaseNotes> 2.0.3 - Adding System Test Attribute
2.0.2 - Update project to netstandard1.1, include new categories</PackageReleaseNotes>
<PackageProjectUrl>https://github.com/brendanconnolly/Xunit.Categories</PackageProjectUrl>
<Copyright>Copyright 2018</Copyright>
<PackageTags>Xunit xunit test category categories trait</PackageTags>
Expand Down
11 changes: 10 additions & 1 deletion test/Xunit.Categories.Test/Scratch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,16 @@ public void TestWorkItem()
throw new NotImplementedException("I'm not that important, all the world knows about me, I'll be fixed in 2030");
}


[Fact]
[SystemTest]
[SystemTest(666)]
[SystemTest("666 a")]
public void TestSystemTest()
{
throw new NotImplementedException("request #8 - This is more black box, high level, and stress testing of a complete running application different to an IntegrationTest");
}





Expand Down

0 comments on commit 8e656f6

Please sign in to comment.