Compare commits

...

7 Commits

Author SHA1 Message Date
dependabot[bot]
181063afcd Bump fantomas from 6.3.7 to 6.3.9 (#58)
* Bump WoofWare.Myriad.Plugins.Attributes from 3.1.4 to 3.1.6

Bumps [WoofWare.Myriad.Plugins.Attributes](https://github.com/Smaug123/WoofWare.Myriad) from 3.1.4 to 3.1.6.
- [Release notes](https://github.com/Smaug123/WoofWare.Myriad/releases)
- [Changelog](https://github.com/Smaug123/WoofWare.Myriad/blob/main/CHANGELOG.md)
- [Commits](https://github.com/Smaug123/WoofWare.Myriad/compare/WoofWare.Myriad.Plugins.Attributes.3.1.4...WoofWare.Myriad.Plugins.Attributes.3.1.6)

---
updated-dependencies:
- dependency-name: WoofWare.Myriad.Plugins.Attributes
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump ApiSurface from 4.0.40 to 4.0.41

Bumps [ApiSurface](https://github.com/G-Research/ApiSurface) from 4.0.40 to 4.0.41.
- [Release notes](https://github.com/G-Research/ApiSurface/releases)
- [Commits](https://github.com/G-Research/ApiSurface/compare/ApiSurface.4.0.40...ApiSurface.4.0.41)

---
updated-dependencies:
- dependency-name: ApiSurface
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump fantomas from 6.3.7 to 6.3.9

Bumps [fantomas](https://github.com/fsprojects/fantomas) from 6.3.7 to 6.3.9.
- [Release notes](https://github.com/fsprojects/fantomas/releases)
- [Changelog](https://github.com/fsprojects/fantomas/blob/main/CHANGELOG.md)
- [Commits](https://github.com/fsprojects/fantomas/compare/v6.3.7...v6.3.9)

---
updated-dependencies:
- dependency-name: fantomas
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump WoofWare.DotnetRuntimeLocator from 0.1.3 to 0.1.4

Bumps [WoofWare.DotnetRuntimeLocator](https://github.com/Smaug123/WoofWare.DotnetRuntimeLocator) from 0.1.3 to 0.1.4.
- [Release notes](https://github.com/Smaug123/WoofWare.DotnetRuntimeLocator/releases)
- [Commits](https://github.com/Smaug123/WoofWare.DotnetRuntimeLocator/compare/WoofWare.DotnetRuntimeLocator.0.1.3...WoofWare.DotnetRuntimeLocator.0.1.4)

---
updated-dependencies:
- dependency-name: WoofWare.DotnetRuntimeLocator
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Deps

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Smaug123 <3138005+Smaug123@users.noreply.github.com>
2024-06-10 18:42:15 +01:00
Patrick Stevens
41a39ca159 No empty namespaces in TRX reports (#60) 2024-06-10 18:08:16 +01:00
Patrick Stevens
eb4dfae8f4 Forbid generics (#55) 2024-06-10 12:18:33 +01:00
Patrick Stevens
78f51d127c Print path to TRX file (#54) 2024-06-10 12:16:16 +01:00
Patrick Stevens
3866823ccd Fix filter (#50) 2024-06-09 14:06:40 +01:00
Patrick Stevens
b600fab887 Fix treatment of optionals which are not in TestCaseData (#49) 2024-06-09 12:24:58 +01:00
Patrick Stevens
8dc23d5b38 Fix path to runtime (#48) 2024-06-09 12:19:29 +01:00
10 changed files with 80 additions and 47 deletions

View File

@@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"fantomas": {
"version": "6.3.7",
"version": "6.3.9",
"commands": [
"fantomas"
]

View File

@@ -74,6 +74,7 @@ jobs:
run: 'nix develop --command dotnet exec ./TestRunner/bin/Release/net8.0/TestRunner.dll ./Consumer/bin/Release/net8.0/Consumer.dll --trx TrxOut/out.trx'
- name: Parse Trx files
uses: NasAmin/trx-parser@v0.6.0
if: always()
id: trx-parser
with:
TRX_PATH: ${{ github.workspace }}/TrxOut

View File

@@ -25,10 +25,15 @@ module TestCaseData =
let ``Consume test data from multiple sources`` (i : int, s : string, arr : float[]) =
lock multipleSources (fun () -> multipleSources.Add (i, s, arr))
let optional = [ Some "hi" ; None ] |> List.map TestCaseData
let optionalData = [ Some "hi" ; None ] |> List.map TestCaseData
[<TestCaseSource(nameof optional)>]
let ``Consume options`` (s : string option) : unit = s |> shouldEqual s
[<TestCaseSource(nameof optionalData)>]
let ``Consume options, TestCaseData`` (s : string option) : unit = s |> shouldEqual s
let optionalRaw = [ Some "hi" ; None ]
[<TestCaseSource(nameof optionalRaw)>]
let ``Consume options, raw`` (s : string option) : unit = s |> shouldEqual s
[<OneTimeTearDown>]
let tearDown () =

View File

@@ -291,9 +291,10 @@ module Filter =
fun a b -> inner1 a b || inner2 a b
| Filter.Name (Match.Exact m) -> fun _fixture method -> method.Method.Name = m
| Filter.Name (Match.Contains m) -> fun _fixture method -> method.Method.Name.Contains m
| Filter.FullyQualifiedName (Match.Exact m) -> fun fixture method -> (fixture.Name + method.Method.Name) = m
| Filter.FullyQualifiedName (Match.Exact m) ->
fun _fixture method -> (method.Method.DeclaringType.FullName + "." + method.Method.Name) = m
| Filter.FullyQualifiedName (Match.Contains m) ->
fun fixture method -> (fixture.Name + method.Method.Name).Contains m
fun _fixture method -> (method.Method.DeclaringType.FullName + "." + method.Method.Name).Contains m
| Filter.TestCategory (Match.Contains m) ->
fun _fixture method -> method.Categories |> List.exists (fun cat -> cat.Contains m)
| Filter.TestCategory (Match.Exact m) -> fun _fixture method -> method.Categories |> List.contains m

View File

@@ -230,6 +230,27 @@ module TestFixture =
(test : SingleTestMethod)
: (Result<TestMemberSuccess, TestMemberFailure> * IndividualTestRunMetadata) list
=
if test.Method.ContainsGenericParameters then
let failureMetadata =
{
Total = TimeSpan.Zero
Start = DateTimeOffset.Now
End = DateTimeOffset.Now
ComputerName = Environment.MachineName
ExecutionId = Guid.NewGuid ()
TestId = Guid.NewGuid ()
TestName = test.Name
ClassName = test.Method.DeclaringType.FullName
StdErr = None
StdOut = None
}
let error =
TestMemberFailure.Malformed [ "Test contained generic parameters; generics are not supported." ]
(Error error, failureMetadata) |> List.singleton
else
let resultPreRun =
(None, test.Modifiers)
||> List.fold (fun _result modifier ->
@@ -332,6 +353,7 @@ module TestFixture =
yield
Guid.NewGuid (),
match arg with
| null -> [| (null : obj) |]
| :? Tuple<obj, obj> as (a, b) -> [| a ; b |]
| :? Tuple<obj, obj, obj> as (a, b, c) -> [| a ; b ; c |]
| :? Tuple<obj, obj, obj, obj> as (a, b, c, d) -> [| a ; b ; c ; d |]

View File

@@ -3,6 +3,11 @@ namespace TestRunner
open System
open System.Xml
[<RequireQualifiedAccess>]
module private XmlUtil =
[<Literal>]
let NS = "http://microsoft.com/schemas/VisualStudio/TeamTest/2010"
/// Describes the times at which a complete test run went through state transitions.
/// These all have semantics specific to the test runner, and I have not rigorously worked out what
/// semantics NUnit has, so take these with considerable amounts of salt.
@@ -22,8 +27,7 @@ type TrxReportTimes =
}
member internal this.toXml (doc : XmlDocument) : XmlNode =
let node =
doc.CreateElement ("Times", "http://microsoft.com/schemas/VisualStudio/TeamTest/2010")
let node = doc.CreateElement ("Times", XmlUtil.NS)
do
let attr = doc.CreateAttribute "creation"
@@ -113,7 +117,7 @@ type TrxDeployment =
}
member internal this.toXml (doc : XmlDocument) : XmlNode =
let node = doc.CreateElement "Deployment"
let node = doc.CreateElement ("Deployment", XmlUtil.NS)
do
let attr = doc.CreateAttribute "runDeploymentRoot"
@@ -149,7 +153,7 @@ type TrxTestSettings =
}
member internal this.toXml (doc : XmlDocument) : XmlNode =
let node = doc.CreateElement "TestSettings"
let node = doc.CreateElement ("TestSettings", XmlUtil.NS)
do
let attr = doc.CreateAttribute "name"
@@ -243,13 +247,13 @@ type TrxErrorInfo =
}
member internal this.toXml (doc : XmlDocument) : XmlNode =
let node = doc.CreateElement "ErrorInfo"
let node = doc.CreateElement ("ErrorInfo", XmlUtil.NS)
match this.Message with
| None -> ()
| Some message ->
let child = doc.CreateTextNode message
let messageNode = doc.CreateElement "Message"
let messageNode = doc.CreateElement ("Message", XmlUtil.NS)
messageNode.AppendChild child |> ignore<XmlNode>
node.AppendChild messageNode |> ignore<XmlNode>
@@ -257,7 +261,7 @@ type TrxErrorInfo =
| None -> ()
| Some stackTrace ->
let child = doc.CreateTextNode stackTrace
let stackTraceNode = doc.CreateElement "StackTrace"
let stackTraceNode = doc.CreateElement ("StackTrace", XmlUtil.NS)
stackTraceNode.AppendChild child |> ignore<XmlNode>
node.AppendChild stackTraceNode |> ignore<XmlNode>
@@ -291,13 +295,13 @@ type TrxOutput =
}
member internal this.toXml (doc : XmlDocument) : XmlNode =
let node = doc.CreateElement "Output"
let node = doc.CreateElement ("Output", XmlUtil.NS)
match this.StdOut with
| None -> ()
| Some stdout ->
let text = doc.CreateTextNode stdout
let childNode = doc.CreateElement "StdOut"
let childNode = doc.CreateElement ("StdOut", XmlUtil.NS)
childNode.AppendChild text |> ignore<XmlNode>
node.AppendChild childNode |> ignore<XmlNode>
@@ -362,7 +366,7 @@ type TrxUnitTestResult =
}
member internal this.toXml (doc : XmlDocument) : XmlNode =
let node = doc.CreateElement "UnitTestResult"
let node = doc.CreateElement ("UnitTestResult", XmlUtil.NS)
do
let attr = doc.CreateAttribute "executionId"
@@ -582,7 +586,7 @@ type TrxTestMethod =
}
member internal this.toXml (doc : XmlDocument) : XmlNode =
let node = doc.CreateElement "TestMethod"
let node = doc.CreateElement ("TestMethod", XmlUtil.NS)
do
let attr = doc.CreateAttribute "codeBase"
@@ -668,7 +672,7 @@ type TrxExecution =
}
member internal this.toXml (doc : XmlDocument) : XmlNode =
let node = doc.CreateElement "Execution"
let node = doc.CreateElement ("Execution", XmlUtil.NS)
do
let attr = doc.CreateAttribute "id"
@@ -723,7 +727,7 @@ type TrxUnitTest =
}
member internal this.toXml (doc : XmlDocument) : XmlNode =
let node = doc.CreateElement "UnitTest"
let node = doc.CreateElement ("UnitTest", XmlUtil.NS)
do
let attr = doc.CreateAttribute "name"
@@ -821,7 +825,7 @@ type TrxTestEntry =
}
member internal this.toXml (doc : XmlDocument) : XmlNode =
let node = doc.CreateElement "TestEntry"
let node = doc.CreateElement ("TestEntry", XmlUtil.NS)
do
let attr = doc.CreateAttribute "testListId"
@@ -905,7 +909,7 @@ type TrxTestListEntry =
}
member internal this.toXml (doc : XmlDocument) : XmlNode =
let node = doc.CreateElement "TestList"
let node = doc.CreateElement ("TestList", XmlUtil.NS)
do
let attr = doc.CreateAttribute "name"
@@ -998,7 +1002,7 @@ type TrxRunInfo =
}
member internal this.toXml (doc : XmlDocument) : XmlNode =
let node = doc.CreateElement "RunInfo"
let node = doc.CreateElement ("RunInfo", XmlUtil.NS)
do
let attr = doc.CreateAttribute "computerName"
@@ -1015,7 +1019,7 @@ type TrxRunInfo =
attr.Value <- this.Timestamp.ToString "o"
node.Attributes.Append attr |> ignore<XmlAttribute>
let childNode = doc.CreateElement "Text"
let childNode = doc.CreateElement ("Text", XmlUtil.NS)
let textNode = doc.CreateTextNode this.Text
childNode.AppendChild textNode |> ignore<XmlNode>
node.AppendChild childNode |> ignore<XmlNode>
@@ -1154,7 +1158,7 @@ type TrxCounters =
}
member internal this.toXml (doc : XmlDocument) : XmlNode =
let node = doc.CreateElement "Counters"
let node = doc.CreateElement ("Counters", XmlUtil.NS)
do
let attr = doc.CreateAttribute "total"
@@ -1475,7 +1479,7 @@ type TrxResultsSummary =
}
member internal this.toXml (doc : XmlDocument) : XmlNode =
let node = doc.CreateElement "ResultSummary"
let node = doc.CreateElement ("ResultSummary", XmlUtil.NS)
do
let attr = doc.CreateAttribute "outcome"
@@ -1486,7 +1490,7 @@ type TrxResultsSummary =
node.AppendChild (this.Output.toXml doc) |> ignore<XmlNode>
do
let runInfosNode = doc.CreateElement "RunInfos"
let runInfosNode = doc.CreateElement ("RunInfos", XmlUtil.NS)
for runInfo in this.RunInfos do
runInfosNode.AppendChild (runInfo.toXml doc) |> ignore<XmlNode>
@@ -1575,8 +1579,7 @@ type TrxReport =
}
member internal this.toXml (doc : XmlDocument) : XmlNode =
let node =
doc.CreateElement ("TestRun", "http://microsoft.com/schemas/VisualStudio/TeamTest/2010")
let node = doc.CreateElement ("TestRun", XmlUtil.NS)
do
let attr = doc.CreateAttribute "id"
@@ -1592,7 +1595,7 @@ type TrxReport =
node.AppendChild (this.Settings.toXml doc) |> ignore<XmlNode>
do
let resultNode = doc.CreateElement "Results"
let resultNode = doc.CreateElement ("Results", XmlUtil.NS)
for result in this.Results do
resultNode.AppendChild (result.toXml doc) |> ignore<XmlNode>
@@ -1600,7 +1603,7 @@ type TrxReport =
node.AppendChild resultNode |> ignore<XmlNode>
do
let defsNode = doc.CreateElement "TestDefinitions"
let defsNode = doc.CreateElement ("TestDefinitions", XmlUtil.NS)
for result in this.TestDefinitions do
defsNode.AppendChild (result.toXml doc) |> ignore<XmlNode>
@@ -1608,7 +1611,7 @@ type TrxReport =
node.AppendChild defsNode |> ignore<XmlNode>
do
let testsNode = doc.CreateElement "TestEntries"
let testsNode = doc.CreateElement ("TestEntries", XmlUtil.NS)
for result in this.TestEntries do
testsNode.AppendChild (result.toXml doc) |> ignore<XmlNode>
@@ -1616,7 +1619,7 @@ type TrxReport =
node.AppendChild testsNode |> ignore<XmlNode>
do
let listsNode = doc.CreateElement "TestLists"
let listsNode = doc.CreateElement ("TestLists", XmlUtil.NS)
for result in this.TestLists do
listsNode.AppendChild (result.toXml doc) |> ignore<XmlNode>

View File

@@ -133,7 +133,7 @@ module Program =
| None ->
// Keep on trucking: let's be optimistic and hope that we're self-contained.
[ dll.Directory ]
| Some (Choice1Of2 runtime) -> [ dll.Directory ; DirectoryInfo runtime.Path ]
| Some (Choice1Of2 runtime) -> [ dll.Directory ; DirectoryInfo $"%s{runtime.Path}/%s{runtime.Version}" ]
| Some (Choice2Of2 sdk) -> [ dll.Directory ; DirectoryInfo sdk.Path ]
let main argv =
@@ -401,6 +401,7 @@ module Program =
let contents = TrxReport.toXml report |> fun d -> d.OuterXml
trxPath.Directory.Create ()
File.WriteAllText (trxPath.FullName, contents)
Console.Error.WriteLine $"Written TRX file: %s{trxPath.FullName}"
| None -> ()
match outcome with

View File

@@ -16,7 +16,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="ApiSurface" Version="4.0.40" />
<PackageReference Include="ApiSurface" Version="4.0.41" />
<PackageReference Include="FsCheck" Version="3.0.0-rc3" />
<PackageReference Include="FsUnit" Version="6.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />

View File

@@ -16,7 +16,7 @@
<PackageId>WoofWare.NUnitTestRunner</PackageId>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarnOn>FS3559</WarnOn>
<WoofWareMyriadPluginVersion>2.1.40</WoofWareMyriadPluginVersion>
<WoofWareMyriadPluginVersion>2.1.42</WoofWareMyriadPluginVersion>
</PropertyGroup>
<ItemGroup>
@@ -39,8 +39,8 @@
<ItemGroup>
<PackageReference Include="Spectre.Console" Version="0.49.1" />
<PackageReference Include="WoofWare.DotnetRuntimeLocator" Version="0.1.3" />
<PackageReference Include="WoofWare.Myriad.Plugins.Attributes" Version="3.1.4" />
<PackageReference Include="WoofWare.DotnetRuntimeLocator" Version="0.1.4" />
<PackageReference Include="WoofWare.Myriad.Plugins.Attributes" Version="3.1.6" />
<PackageReference Include="Myriad.SDK" Version="0.8.3" />
<PackageReference Include="WoofWare.Myriad.Plugins" Version="$(WoofWareMyriadPluginVersion)" PrivateAssets="all" />
</ItemGroup>

View File

@@ -3,13 +3,13 @@
{fetchNuGet}: [
(fetchNuGet {
pname = "ApiSurface";
version = "4.0.40";
sha256 = "1c9z0b6minlripwrjmv4yd5w8zj4lcpak4x41izh7ygx8kgmbvx0";
version = "4.0.41";
sha256 = "03kfa5ngmgkik9lc58sp8s9rrh9g40hhgjnrv662ks0d0y2i9i89";
})
(fetchNuGet {
pname = "fantomas";
version = "6.3.7";
sha256 = "1z1a5bw7vwz6g8nvfgkvx66jnm4hmvn62vbyq0as60nw0jlvaidl";
version = "6.3.9";
sha256 = "1b34iiiff02bbzjv03zyna8xmrgs6y87zdvp5i5k58fcqpjw44sx";
})
(fetchNuGet {
pname = "FsCheck";
@@ -183,18 +183,18 @@
})
(fetchNuGet {
pname = "WoofWare.DotnetRuntimeLocator";
version = "0.1.3";
sha256 = "0qw41mcvx4qy012pj1dlpdfwsz036qrx7xnzsirk5fz715f1a45m";
version = "0.1.4";
sha256 = "19pp4qlyf18g704ppbcsm1rhjqjpi84py18yljj9nx70331m8bpg";
})
(fetchNuGet {
pname = "WoofWare.Myriad.Plugins";
version = "2.1.40";
sha256 = "025lv42zjvqpr2di0iaqhqpricqary3l2a3cxgjjl0zxzflfbmx2";
version = "2.1.42";
sha256 = "0px46m734gsn1xa97111v1nwkyc2j52bw7z4bjdljzkmzzmnqa91";
})
(fetchNuGet {
pname = "WoofWare.Myriad.Plugins.Attributes";
version = "3.1.4";
sha256 = "06yw013f2qs2r8bxvja2c5kzbqc5knd3sc3pf6w5gaz4fbzwc2c3";
version = "3.1.6";
sha256 = "0786pr1p0nq0854mqi2cddmh185j3jihwn6azz9wiy6nxawjbrd2";
})
(fetchNuGet {
pname = "WoofWare.PrattParser";