< Summary

Class:GDX.Developer.Reports.NUnit.TestSuite
Assembly:GDX
File(s):D:/BuildAgent/work/GDX-Documentation/Projects/GDX_Development/Packages/com.dotbunny.gdx/GDX/Developer/Reports/NUnit/TestSuite.cs
Covered lines:45
Uncovered lines:41
Coverable lines:86
Total lines:110
Line coverage:52.3% (45 of 86)
Covered branches:0
Total branches:0
Covered methods:39
Total methods:41
Method coverage:95.1% (39 of 41)

Coverage History

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
TestSuite()0%110100%
Process(...)0%8.237070.73%
GetPassCount()0%20400%
GetFailCount()0%20400%

File(s)

D:/BuildAgent/work/GDX-Documentation/Projects/GDX_Development/Packages/com.dotbunny.gdx/GDX/Developer/Reports/NUnit/TestSuite.cs

#LineLine coverage
 1// Copyright (c) 2020-2022 dotBunny Inc.
 2// dotBunny licenses this file to you under the BSL-1.0 license.
 3// See the LICENSE file in the project root for more information.
 4
 5using System.Collections.Generic;
 6
 7namespace GDX.Developer.Reports.NUnit
 8{
 9    public class TestSuite
 10    {
 211        public string Type { get; set; }
 212        public string Id { get; set; }
 1613        public string Name { get; set; }
 1614        public string FullName { get; set; }
 1615        public string ClassName { get; set; }
 216        public string RunState { get; set; }
 1017        public int TestCaseCount { get; set; }
 218        public string Result { get; set; }
 219        public string Label { get; set; }
 220        public string StartTime { get; set; }
 221        public string EndTime { get; set; }
 222        public float Duration { get; set; }
 623        public int Total => Passed + Failed + Inconclusive + Skipped;
 2024        public int Passed { get; set; }
 1825        public int Failed { get; set; }
 1626        public int Inconclusive { get; set; }
 2027        public int Skipped { get; set; }
 628        public int Asserts { get; set; }
 229        public Properties Properties { get; set; }
 30
 1331        public readonly List<TestCase> TestCases = new List<TestCase>();
 32
 1333        public readonly List<TestSuite> TestSuites = new List<TestSuite>();
 34
 35        public void Process(string passedResult, string failedResult, string inconclusiveResult, string skippedResult)
 436        {
 437            Passed = 0;
 438            Failed = 0;
 439            Inconclusive = 0;
 440            Skipped = 0;
 41
 2242            foreach (TestCase t in TestCases)
 543            {
 544                if (t.Result == passedResult)
 245                {
 246                    Passed++;
 247                }
 348                else if (t.Result == failedResult)
 149                {
 150                    Failed++;
 151                }
 252                else if (t.Result == inconclusiveResult)
 053                {
 054                    Inconclusive++;
 055                }
 256                else if (t.Result == skippedResult)
 257                {
 258                    Skipped++;
 259                }
 560            }
 461            TestCaseCount = Total;
 62
 63            // Update children
 1264            foreach (TestSuite s in TestSuites)
 065            {
 066                s.Process(passedResult, failedResult, inconclusiveResult, skippedResult);
 067                Passed += s.Passed;
 068                Failed += s.Failed;
 069                Inconclusive += s.Inconclusive;
 070                Skipped += s.Skipped;
 071                TestCaseCount += Total;
 072            }
 473        }
 74
 75        public int GetPassCount()
 076        {
 077            int passCount = 0;
 078            foreach (TestCase testCase in TestCases)
 079            {
 080                if (testCase.Result == NUnitReport.PassedString)
 081                {
 082                    passCount++;
 083                }
 084            }
 085            foreach (TestSuite testSuite in TestSuites)
 086            {
 087                passCount += testSuite.GetPassCount();
 088            }
 089            return passCount;
 090        }
 91
 92        public int GetFailCount()
 093        {
 094            int failCount = 0;
 095            foreach (TestCase testCase in TestCases)
 096            {
 097                if (testCase.Result == NUnitReport.FailedString)
 098                {
 099                    failCount++;
 0100                }
 0101            }
 0102            foreach (TestSuite testSuite in TestSuites)
 0103            {
 0104                failCount += testSuite.GetPassCount();
 0105            }
 0106            return failCount;
 0107        }
 108    }
 109
 110}