Exemplo n.º 1
0
        public bool Terminate()
        {
            bool bResult = false;

            //NOTE: Since exceptions are a way-of-life in COOL, and the fact that they are just
            //caught by the runtime before passed back to LTM, we lose the entire stack and just
            //an unknown error code is returned.

            //To help solve this we will wrap the call in a try catch and actually
            //log the exception to the LTM output window...
            try
            {
                //Skipped
                if (this.Skipped || !this.Implemented)
                {
                    return(true);
                }

                if (Terminate(Param) == TEST_PASS)
                {
                    bResult = true;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                HandleException(e);
            }

            try
            {
                //Clear any previous existing info (in the static class).
                if (this is CTestModule)
                {
                    //Note: We actually have to clear these "statics" since they are not cleaned up
                    //until the process exits.  Which means that if you run again, in an apartment model
                    //thread it will try to release these when setting them which is not allowed to
                    //call a method on an object created in another apartment
                    CModInfo.Dispose();
                }
            }
            catch (Exception e)
            {
                HandleException(e);
            }

            //This is also a good point to hint to the GC to free up any unused memory
            //at the end of each TestCase and the end of each module.
            GC.Collect();
            GC.WaitForPendingFinalizers();
            return(bResult);
        }
Exemplo n.º 2
0
        public bool Terminate()
        {
            bool bResult = false;

            try
            {
                //Skipped
                if (this.Skipped || !this.Implemented)
                {
                    return(true);
                }

                if (Terminate(Param) == TEST_PASS)
                {
                    bResult = true;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                HandleException(e);
            }

            try
            {
                //Clear any previous existing info (in the static class).
                if (this is CTestModule)
                {
                    //Note: We actually have to clear these "statics" since they are not cleaned up
                    //until the process exits.  Which means that if you run again, in an apartment model
                    //thread it will try to release these when setting them which is not allowed to
                    //call a method on an object created in another apartment
                    CModInfo.Dispose();
                }
            }
            catch (Exception e)
            {
                HandleException(e);
            }

            //This is also a good point to hint to the GC to free up any unused memory
            //at the end of each TestCase and the end of each module.
            GC.Collect();
            GC.WaitForPendingFinalizers();
            return(bResult);
        }