< Summary

Class:GDX.Developer.Reports.BuildVerification.SimpleTestBehaviour
Assembly:GDX
File(s):D:/BuildAgent/work/GDX-Documentation/Projects/GDX_Development/Packages/com.dotbunny.gdx/GDX/Developer/Reports/BuildVerification/SimpleTestBehaviour.cs
Covered lines:0
Uncovered lines:31
Coverable lines:31
Total lines:75
Line coverage:0% (0 of 31)
Covered branches:0
Total branches:0
Covered methods:0
Total methods:5
Method coverage:0% (0 of 5)

Coverage History

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Setup()0%2100%
TearDown()0%2100%
Awake()0%2100%
Start()0%2100%
RunTest()0%2100%

File(s)

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

#LineLine coverage
 1using System;
 2using System.Diagnostics;
 3using GDX.Developer.Reports.NUnit;
 4using UnityEngine;
 5
 6namespace GDX.Developer.Reports.BuildVerification
 7{
 8    public abstract class SimpleTestBehaviour : MonoBehaviour, ITestBehaviour
 9    {
 10        string m_StartTime;
 11        Stopwatch m_Timer;
 12
 13        public abstract TestCase Check();
 14        public abstract string GetIdentifier();
 15
 16        /// <inheritdoc />
 17        public virtual void Setup()
 018        {
 19
 020        }
 21
 22        /// <inheritdoc />
 23        public virtual void TearDown()
 024        {
 025        }
 26
 27
 28
 29        void Awake()
 030        {
 031            TestRunner.AddTest(this);
 032        }
 33
 34        /// <summary>
 35        ///     Unity's Start event.
 36        /// </summary>
 37#pragma warning disable IDE0051
 38        // ReSharper disable UnusedMember.Local
 39        void Start()
 040        {
 041            m_StartTime = DateTime.Now.ToString(Localization.UtcTimestampFormat);
 042            m_Timer = new Stopwatch();
 043            m_Timer.Restart();
 44
 045            TestCase testCase = RunTest();
 46
 047            m_Timer.Stop();
 048            testCase.Duration = m_Timer.ElapsedMilliseconds / 1000f;
 049            testCase.EndTime = DateTime.Now.ToString(Localization.UtcTimestampFormat);
 050            testCase.StartTime = m_StartTime;
 51
 052            TestRunner.RemoveTest(this);
 053        }
 54        // ReSharper restore UnusedMember.Local
 55#pragma warning restore IDE0051
 56
 57        TestCase RunTest()
 058        {
 59            try
 060            {
 061                Setup();
 062                TestCase testCase = Check();
 063                TearDown();
 064                return testCase;
 65            }
 066            catch (Exception e)
 067            {
 068                TestCase testCase = BuildVerificationReport.Assert(GetIdentifier(), false, e.Message);
 069                testCase.StackTrace = e.StackTrace;
 070                TearDown();
 071                return testCase;
 72            }
 073        }
 74    }
 75}