< Summary

Class:GDX.Developer.Reports.BuildVerification.SimpleTestBehaviour
Assembly:GDX
File(s):./Packages/com.dotbunny.gdx/GDX/Developer/Reports/BuildVerification/SimpleTestBehaviour.cs
Covered lines:0
Uncovered lines:40
Coverable lines:40
Total lines:88
Line coverage:0% (0 of 40)
Covered branches:0
Total branches:0
Covered methods:0
Total methods:6
Method coverage:0% (0 of 6)

Coverage History

Metrics

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

File(s)

./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    {
 010        int m_frameWait = 5;
 11        string m_StartTime;
 12        Stopwatch m_Timer;
 13
 14        void Start()
 015        {
 016            TestRunner.AddTest(this);
 017        }
 18
 19        /// <summary>
 20        ///     Run the test in Unity's late update
 21        /// </summary>
 22#pragma warning disable IDE0051
 23        // ReSharper disable UnusedMember.Local
 24        void Update()
 025        {
 26            // Handle frame delay
 027            if (m_frameWait > 0)
 028            {
 029                m_frameWait--;
 030                return;
 31            }
 32
 033            if (m_frameWait < 0)
 034            {
 035                return;
 36            }
 37
 038            m_frameWait--;
 39
 040            m_StartTime = DateTime.Now.ToString(Localization.UtcTimestampFormat);
 041            m_Timer = new Stopwatch();
 042            m_Timer.Restart();
 43
 044            TestCase testCase = RunTest();
 45
 046            m_Timer.Stop();
 047            testCase.Duration = m_Timer.ElapsedMilliseconds / 1000f;
 048            testCase.EndTime = DateTime.Now.ToString(Localization.UtcTimestampFormat);
 049            testCase.StartTime = m_StartTime;
 50
 051            TestRunner.RemoveTest(this);
 052        }
 53
 54        // ReSharper restore UnusedMember.Local
 55#pragma warning restore IDE0051
 56
 57        public abstract TestCase Check();
 58        public abstract string GetIdentifier();
 59
 60        /// <inheritdoc />
 61        public virtual void Setup()
 062        {
 063        }
 64
 65        /// <inheritdoc />
 66        public virtual void TearDown()
 067        {
 068        }
 69
 70        TestCase RunTest()
 071        {
 72            try
 073            {
 074                Setup();
 075                TestCase testCase = Check();
 076                TearDown();
 077                return testCase;
 78            }
 079            catch (Exception e)
 080            {
 081                TestCase testCase = BuildVerificationReport.Assert(GetIdentifier(), false, e.Message);
 082                testCase.StackTrace = e.StackTrace;
 083                TearDown();
 084                return testCase;
 85            }
 086        }
 87    }
 88}