예제 #1
0
        private void UpdateCurrentTest()
        {
            testMetadatas[executedTest].State = TestState.Pending;
            bool isTestRunning;

            try
            {
                isTestRunning = currentTestExecutionEnumerator.MoveNext();
            }
            catch (Exception e)
            {
                logger.ErrorFormat("Test {0} failed:", e, executedTest.GetType().GetNameWithNesting());
                testMetadatas[executedTest].State = TestState.Failed;
                isTestRunning = false;
            }

            if (isTestRunning)
            {
                return;
            }

            executedTest.Teardown();
            executedTest = null;
            currentTestExecutionEnumerator = null;
        }
예제 #2
0
        private void DrawTestView(IEditorImguiTest test)
        {
            EditorGUILayout.BeginHorizontal();
            {
                // GUILayout does not support indentation so draw one in front of GUILayoutButton manually.
                GUILayout.Space(20f);

                DrawRunTestButton(test);

                EditorGUILayout.BeginVertical();
                {
                    // Draw foldout.
                    GUIStyle foldout = new GUIStyle(EditorStyles.foldout);
                    if (testMetadatas[test].FoldedOut)
                    {
                        foldout.fontStyle = FontStyle.Bold;
                    }

                    testMetadatas[test].FoldedOut = EditorGUILayout.Foldout(testMetadatas[test].FoldedOut, test.GetType().Name, foldout);

                    // Draw a test state indicator to the left of the foldout.
                    Rect foldoutRect = GUILayoutUtility.GetLastRect();
                    DrawTestStateIndicator(new Vector2(61f, foldoutRect.y), testMetadatas[test].State);

                    // Draw foldout contents, if necessary.
                    if (testMetadatas[test].FoldedOut)
                    {
                        DrawTestDescription(test);
                        if (DrawRecordTestButton(test))
                        {
                            // Workaround for EndHorizontal.
                            return;
                        }
                        GUILayoutUtility.GetRect(3f, 3f);
                    }
                }
                EditorGUILayout.EndVertical();
            }
            EditorGUILayout.EndHorizontal();
        }