Exemplo n.º 1
0
        public static void Run(List<Assembly> assemblies, string goalString)
        {
            MCCmdLineParams settings = new MCCmdLineParams();
            //            if (!Parser.ParseArgumentsWithUsage(args, settings))
            //            {
            //                return;
            //            }

            #region load the libraries
            List<Assembly> libs = new List<Assembly>();
            try
            {

                if ( assemblies != null)
                {
                    foreach (Assembly l in assemblies)
                    {
            //                        libs.Add(System.Reflection.Assembly.LoadFrom(l));
                        libs.Add(l);
                    }
                }
            }
            catch (Exception e)
            {
                throw new ModelProgramUserException(e.Message);
            }
            #endregion

            #region load the test cases if any
            CompoundTerm goal = null;
            if (!String.IsNullOrEmpty(settings.goal))
            {
                try
                {
                    System.IO.StreamReader goalReader =
                        new System.IO.StreamReader(settings.goal);
                    string goalAsString = goalReader.ReadToEnd();
                    goalReader.Close();
                    goal = CompoundTerm.Parse(goalAsString);
                }
                catch (Exception e)
                {
                    throw new ModelProgramUserException("Cannot create goal: " + e.Message);
                }
            }
            else
            {
                Console.WriteLine("No goal was specified, counting distinct states and transitions.");
                Console.WriteLine("Invalid end states check currently not enabled.");
            }
            #endregion

            #region create a model program for each model using the factory method and compose into product
            string mpMethodName;
            string mpClassName;
            ModelProgram mp = null;
            if (settings.model != null && settings.model.Length > 0)
            {
                if (libs.Count == 0)
                {
                    throw new ModelProgramUserException("No reference was provided to load models from.");
                }
                ReflectionHelper.SplitFullMethodName(settings.model[0], out mpClassName, out mpMethodName);
                Type mpType = ReflectionHelper.FindType(libs, mpClassName);
                MethodInfo mpMethod = ReflectionHelper.FindMethod(mpType, mpMethodName, Type.EmptyTypes, typeof(ModelProgram));
                try
                {
                    mp = (ModelProgram)mpMethod.Invoke(null, null);
                }
                catch (Exception e)
                {
                    throw new ModelProgramUserException("Invocation of '" + settings.model[0] + "' failed: " + e.ToString());
                }
                for (int i = 1; i < settings.model.Length; i++)
                {
                    ReflectionHelper.SplitFullMethodName(settings.model[i], out mpClassName, out mpMethodName);
                    mpType = ReflectionHelper.FindType(libs, mpClassName);
                    mpMethod = ReflectionHelper.FindMethod(mpType, mpMethodName, Type.EmptyTypes, typeof(ModelProgram));
                    ModelProgram mp2 = null;
                    try
                    {
                        mp2 = (ModelProgram)mpMethod.Invoke(null, null);
                    }
                    catch (Exception e)
                    {
                        throw new ModelProgramUserException("Invocation of '" + settings.model[i] + "' failed: " + e.ToString());
                    }
                    mp = new ProductModelProgram(mp, mp2);
                }
            }
            #endregion

            if (mp == null)
            {
                Console.WriteLine("ModelProgram was null");
                Console.WriteLine("Tried to instantiate:");
                if (settings.model != null)
                    foreach (string s in settings.model)
                        Console.WriteLine(s);
                return;
            }
            Reachability mc = new Reachability();
            mc.excludeIsomorphicStates = settings.excludeIsomorphic;
            mc.modelProgram = mp;
            DateTime before = DateTime.Now;
            ReachabilityResult result = mc.CheckReachability();
            DateTime after = DateTime.Now;
            Console.WriteLine("Results of reachability checking:");
            Console.WriteLine();
            Console.WriteLine(" States reached: " + result.StateCount);
            Console.WriteLine(" Transitions covered: " + result.TransitionCount);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Provides programmatic access to the commandline utility 'mp2dot.exe'.
        /// </summary>
        /// <param name="args">command line arguments: model program(s), optional settings for the viewer</param>
        /// <remarks>The settings are displayed when 'mpv.exe /?' is executed from the command line without arguments.</remarks>
        public static void RunWithCommandLineArguments(params string[] args)
        {
            ProgramSettings settings = new ProgramSettings();
            if (!Parser.ParseArgumentsWithUsage(args, settings))
            {
                return;
            }

            #region load the libraries
            List<Assembly> libs = new List<Assembly>();
            try
            {

                if (settings.reference != null)
                {
                    foreach (string l in settings.reference)
                    {
                        libs.Add(System.Reflection.Assembly.LoadFrom(l));
                    }
                }
            }
            catch (Exception e)
            {
                throw new ModelProgramUserException(e.Message);
            }
            #endregion

            #region create a model program for each model using the factory method and compose into product
            string mpMethodName;
            string mpClassName;
            ModelProgram mp = null;
            if (settings.model != null && settings.model.Length > 0)
            {
                if (libs.Count == 0)
                {
                    throw new ModelProgramUserException("No reference was provided to load models from.");
                }
                ReflectionHelper.SplitFullMethodName(settings.model[0], out mpClassName, out mpMethodName);
                Type mpType = ReflectionHelper.FindType(libs, mpClassName);
                MethodInfo mpMethod = ReflectionHelper.FindMethod(mpType, mpMethodName, Type.EmptyTypes, typeof(ModelProgram));
                try
                {
                    mp = (ModelProgram)mpMethod.Invoke(null, null);
                }
                catch (Exception e)
                {
                    throw new ModelProgramUserException("Invocation of '" + settings.model[0] + "' failed: " + e.ToString());
                }
                for (int i = 1; i < settings.model.Length; i++)
                {
                    ReflectionHelper.SplitFullMethodName(settings.model[i], out mpClassName, out mpMethodName);
                    mpType = ReflectionHelper.FindType(libs, mpClassName);
                    mpMethod = ReflectionHelper.FindMethod(mpType, mpMethodName, Type.EmptyTypes, typeof(ModelProgram));
                    ModelProgram mp2 = null;
                    try
                    {
                        mp2 = (ModelProgram)mpMethod.Invoke(null, null);
                    }
                    catch (Exception e)
                    {
                        throw new ModelProgramUserException("Invocation of '" + settings.model[i] + "' failed: " + e.ToString());
                    }
                    mp = new ProductModelProgram(mp, mp2);
                }
            }
            #endregion

            #region create a model program from given namespace and feature names
            if (settings.mp != null && settings.mp.Length > 0)
            {
                if (libs.Count == 0)
                {
                    throw new ModelProgramUserException("No reference was provided to load models from.");
                }
                //parse the model program name and the feature names for each entry
                foreach (string mps in settings.mp)
                {
                    //the first element is the model program, the remaining ones are
                    //feature names
                    string[] mpsSplit = mps.Split(new string[] { "[", "]", "," },
                        StringSplitOptions.RemoveEmptyEntries);
                    if (mpsSplit.Length == 0)
                    {
                        throw new ModelProgramUserException("Invalid model program specifier '" + mps + "'.");
                    }
                    string mpName = mpsSplit[0];
                    Assembly mpAssembly = ReflectionHelper.FindAssembly(libs, mpName);
                    Set<string> mpFeatures = new Set<string>(mpsSplit).Remove(mpName);
                    ModelProgram mp1 = new LibraryModelProgram(mpAssembly, mpName, mpFeatures);
                    mp = (mp == null ? mp1 : new ProductModelProgram(mp, mp1));
                }
            }

            #endregion

            #region load the test cases if any
            Sequence<Sequence<CompoundTerm>> testcases = Sequence<Sequence<CompoundTerm>>.EmptySequence;
            if (!String.IsNullOrEmpty(settings.testSuite))
            {
                try
                {
                    System.IO.StreamReader testSuiteReader =
                        new System.IO.StreamReader(settings.testSuite);
                    string testSuiteAsString = testSuiteReader.ReadToEnd();
                    testSuiteReader.Close();
                    CompoundTerm testSuite = CompoundTerm.Parse(testSuiteAsString);
                    foreach (CompoundTerm testCaseTerm in testSuite.Arguments)
                    {
                        Sequence<CompoundTerm> testCase =
                            testCaseTerm.Arguments.Convert<CompoundTerm>(delegate(Term t) { return (CompoundTerm)t; });
                        testcases = testcases.AddLast(testCase);
                    }
                }
                catch (Exception e)
                {
                    throw new ModelProgramUserException("Cannot create test suite: " + e.Message);
                }
            }
            #endregion

            #region load the fsms if any
            Dictionary<string, FSM> fsms = new Dictionary<string, FSM>();
            if (settings.fsm != null && settings.fsm.Length > 0)
            {
                try
                {
                    foreach (string fsmFile in settings.fsm)
                    {
                        System.IO.StreamReader fsmReader = new System.IO.StreamReader(fsmFile);
                        string fsmAsString = fsmReader.ReadToEnd();
                        fsmReader.Close();
                        fsms[fsmFile] = FSM.FromTerm(CompoundTerm.Parse(fsmAsString));
                    }
                }
                catch (Exception e)
                {
                    throw new ModelProgramUserException("Cannot create fsm: " + e.Message);
                }
            }
            #endregion

            #region load the state variables for state tooltip if any
            if (!String.IsNullOrEmpty(settings.StateVarsFile))
            {
                try
                {
                    System.IO.StreamReader stateVarsReader =
                        new System.IO.StreamReader(settings.StateVarsFile);
                    StateTooltipVars = stateVarsReader.ReadToEnd();
                    stateVarsReader.Close();
                }
                catch (Exception e)
                {
                    throw new ModelProgramUserException("Cannot create state variables list: " + e.Message);
                }
            }
            #endregion

            if (mp == null && testcases.IsEmpty && fsms.Count == 0)
            {
                throw new ModelProgramUserException("No model, fsm, or test suite was given.");
            }

            if (!testcases.IsEmpty)
            {
                FSM fa = FsmTraversals.GenerateTestSequenceAutomaton(
                    settings.startTestAction, testcases, GetActionSymbols(testcases));
                ModelProgram famp = new FsmModelProgram(fa, settings.testSuite);
                if (mp == null)
                    mp = famp;
                else
                    mp = new ProductModelProgram(mp, famp);
            }

            if (fsms.Count > 0)
            {
                foreach (string fsmName in fsms.Keys)
                {
                    ModelProgram fsmmp = new FsmModelProgram(fsms[fsmName], fsmName);
                    if (mp == null)
                        mp = fsmmp;
                    else
                        mp = new ProductModelProgram(mp, fsmmp);
                }
            }

            // must replace form.View with something that doesn't depend on Windows.Forms or GLEE
            //ModelProgramGraphViewForm form = new ModelProgramGraphViewForm("Model Program Viewer");
            DummyGraphViewForm form = new DummyGraphViewForm("mp2dot");
            //configure the settings of the viewer
            form.View.AcceptingStatesMarked = settings.acceptingStatesMarked;
            form.View.TransitionLabels = settings.transitionLabels;
            form.View.CombineActions = settings.combineActions;
            form.View.Direction = settings.direction;
            form.View.UnsafeStateColor = Color.FromName(settings.unsafeStateColor);
            form.View.HoverColor = Color.FromName(settings.hoverColor);
            form.View.InitialStateColor = Color.FromName(settings.initialStateColor);
            form.View.LoopsVisible = settings.loopsVisible;
            form.View.MaxTransitions = settings.maxTransitions;
            form.View.NodeLabelsVisible = settings.nodeLabelsVisible;
            form.View.SelectionColor = Color.FromName(settings.selectionColor);
            form.View.MergeLabels = settings.mergeLabels;
            form.View.StateShape = settings.stateShape;
            form.View.DeadStateColor = Color.FromName(settings.deadStateColor);
            form.View.InitialTransitions = settings.initialTransitions;
            form.View.LivenessCheckIsOn = settings.livenessCheckIsOn;
            form.View.ExcludeIsomorphicStates = settings.excludeIsomorphicStates;
            form.View.SafetyCheckIsOn = settings.safetyCheckIsOn;
            form.View.DeadstatesVisible = settings.deadStatesVisible;

            form.View.SetModelProgram(mp);
            form.View.graphWorker();
            form.View.WriteExplorationStatistics();

            if (!String.IsNullOrEmpty(settings.dotFileName))
            {
                WriteDotFile(form, settings.dotFileName);
            }

            if (!String.IsNullOrEmpty(settings.machineFileName))
            {
                WriteFSMFile(form, settings.machineFileName);
            }
        }
Exemplo n.º 3
0
        public static void RunWithCommandLineArguments(string[] args)
        {
            //System.Diagnostics.Debugger.Break();
            ConformanceTester confTester = null;
            try
            {

                ConfTesterCommandLineSettings settings = new ConfTesterCommandLineSettings();
                if (!Parser.ParseArgumentsWithUsage(args, settings))
                {
                    //Console.ReadLine();
                    return;
                }

                #region load the libraries
                List<Assembly> libs = new List<Assembly>();
                try
                {
                    if (settings.reference != null)
                    {
                        foreach (string l in settings.reference)
                        {
                            libs.Add(System.Reflection.Assembly.LoadFrom(l));
                        }
                    }
                }
                catch (Exception e)
                {
                    throw new ModelProgramUserException(e.Message);
                }
                #endregion

                #region create the implementation stepper using the factory method
                string implStepperMethodName;
                string implStepperClassName;
                ReflectionHelper.SplitFullMethodName(settings.iut, out implStepperClassName, out implStepperMethodName);
                Type implStepperType = ReflectionHelper.FindType(libs, implStepperClassName);
                MethodInfo implStepperMethod = ReflectionHelper.FindMethod(implStepperType, implStepperMethodName, Type.EmptyTypes, typeof(IStepper));
                IStepper implStepper = null;
                try
                {
                    implStepper = (IStepper)implStepperMethod.Invoke(null, null);
                }
                catch (Exception e)
                {
                    throw new ModelProgramUserException("Invocation of '" + settings.iut + "' failed: " + e.ToString());
                }
                #endregion

                #region create a model program for each model using the factory method and compose into product
                string mpMethodName;
                string mpClassName;
                ModelProgram mp = null;
                if (settings.model != null && settings.model.Length > 0)
                {
                    ReflectionHelper.SplitFullMethodName(settings.model[0], out mpClassName, out mpMethodName);
                    Type mpType = ReflectionHelper.FindType(libs, mpClassName);
                    MethodInfo mpMethod = ReflectionHelper.FindMethod(mpType, mpMethodName, Type.EmptyTypes, typeof(ModelProgram));
                    try
                    {
                        mp = (ModelProgram)mpMethod.Invoke(null, null);
                    }
                    catch (Exception e)
                    {
                        throw new ModelProgramUserException("Invocation of '" + settings.model[0] + "' failed: " + e.ToString());
                    }
                    for (int i = 1; i < settings.model.Length; i++)
                    {
                        ReflectionHelper.SplitFullMethodName(settings.model[i], out mpClassName, out mpMethodName);
                        mpType = ReflectionHelper.FindType(libs, mpClassName);
                        mpMethod = ReflectionHelper.FindMethod(mpType, mpMethodName, Type.EmptyTypes, typeof(ModelProgram));
                        ModelProgram mp2 = null;
                        try
                        {
                            mp2 = (ModelProgram)mpMethod.Invoke(null, null);
                        }
                        catch (Exception e)
                        {
                            throw new ModelProgramUserException("Invocation of '" + settings.model[i] + "' failed: " + e.ToString());
                        }
                        mp = new ProductModelProgram(mp, mp2);
                    }
                }
                #endregion

                #region create a model program from given namespace and feature names
                if (settings.mp != null && settings.mp.Length > 0)
                {
                    if (libs.Count == 0)
                    {
                        throw new ModelProgramUserException("No reference was provided to load models from.");
                    }
                    //parse the model program name and the feature names for each entry
                    foreach (string mps in settings.mp)
                    {
                        //the first element is the model program, the remaining ones are
                        //feature names
                        string[] mpsSplit = mps.Split(new string[] { "[", "]", "," },
                            StringSplitOptions.RemoveEmptyEntries);
                        if (mpsSplit.Length == 0)
                        {
                            throw new ModelProgramUserException("Invalid model program specifier '" + mps + "'.");
                        }
                        string mpName = mpsSplit[0];
                        Assembly mpAssembly = ReflectionHelper.FindAssembly(libs, mpName);
                        Set<string> mpFeatures = new Set<string>(mpsSplit).Remove(mpName);
                        ModelProgram mp1 = new LibraryModelProgram(mpAssembly, mpName, mpFeatures);
                        mp = (mp == null ? mp1 : new ProductModelProgram(mp, mp1));
                    }
                }

                #endregion

                #region load the test cases if any
                Sequence<Sequence<CompoundTerm>> testcases = Sequence<Sequence<CompoundTerm>>.EmptySequence;
                if (!String.IsNullOrEmpty(settings.testSuite))
                {
                    try
                    {
                        System.IO.StreamReader testSuiteReader =
                            new System.IO.StreamReader(settings.testSuite);
                        string testSuiteAsString = testSuiteReader.ReadToEnd();
                        testSuiteReader.Close();
                        CompoundTerm testSuite = (CompoundTerm)Term.Parse(testSuiteAsString);
                        foreach (CompoundTerm testCaseTerm in testSuite.Arguments)
                        {
                            Sequence<CompoundTerm> testCase =
                                testCaseTerm.Arguments.Convert<CompoundTerm>(delegate(Term t) { return (CompoundTerm)t; });
                            testcases = testcases.AddLast(testCase);
                        }
                    }
                    catch (Exception e)
                    {
                        throw new ModelProgramUserException("Cannot create test suite: " + e.Message);
                    }
                }
                #endregion

                #region load the fsms if any
                Dictionary<string, FSM> fsms = new Dictionary<string, FSM>();
                if (settings.fsm != null && settings.fsm.Length > 0)
                {
                    try
                    {
                        foreach (string fsmFile in settings.fsm)
                        {
                            System.IO.StreamReader fsmReader = new System.IO.StreamReader(fsmFile);
                            string fsmAsString = fsmReader.ReadToEnd();
                            fsmReader.Close();
                            fsms[fsmFile] = FSM.FromTerm(CompoundTerm.Parse(fsmAsString));
                        }
                    }
                    catch (Exception e)
                    {
                        throw new ModelProgramUserException("Cannot create fsm: " + e.Message);
                    }
                }
                #endregion

                // Requirements metrics

                #region load all the requirements from an external file - if any
                if (!String.IsNullOrEmpty(settings.RequirementsFile))
                {
                    try
                    {
                        System.IO.StreamReader reqsReader =
                            new System.IO.StreamReader(settings.RequirementsFile);
                        string line;
                        char[] splitchars = { '|' };
                        string[] splitedLine;
                        while ((line = reqsReader.ReadLine()) != null)
                        {
                            if (line.Length > 5)
                            {
                                splitedLine = line.Split(splitchars);
                                // The format of a requirement line is:
                                // action (ignore by the parser) | id | description
                                AllRequirements.Add(new KeyValuePair<string, string>(splitedLine[1].Trim().ToLower(), splitedLine[2].Trim().ToLower()));
                            }
                        }
                        reqsReader.Close();
                    }
                    catch (Exception e)
                    {
                        throw new ModelProgramUserException("Cannot create all-requirements list: " + e.Message);
                    }
                }
                #endregion

                if (mp == null && testcases.IsEmpty && fsms.Count == 0)
                {
                    throw new ModelProgramUserException("No model, fsm, or test suite was given.");
                }

                if (fsms.Count > 0)
                {
                    foreach (string fsmName in fsms.Keys)
                    {
                        ModelProgram fsmmp = new FsmModelProgram(fsms[fsmName], fsmName);
                        if (mp == null)
                            mp = fsmmp;
                        else
                            mp = new ProductModelProgram(mp, fsmmp);
                    }
                }

                #region create the model stepper
                IStrategy ms;
                Set<Symbol> obs = new Set<string>(settings.observableAction).Convert<Symbol>(delegate(string s) { return Symbol.Parse(s); });
                if (!testcases.IsEmpty)
                {
                    ms = new TestSuiteStepper(settings.startTestAction, testcases, mp);
                }
                else
                {
                    ms = CreateModelStepper(libs, mp, settings.modelStepper, settings.coverage, obs);
                }

                #endregion

                confTester = new ConformanceTester(ms, implStepper);

                #region configure conformance tester settings

                confTester.ContinueOnFailure = settings.continueOnFailure;
                confTester.StepsCnt = (testcases.IsEmpty ? settings.steps : 0);
                confTester.MaxStepsCnt = (testcases.IsEmpty ? settings.maxSteps : 0);
                confTester.RunsCnt = (testcases.IsEmpty ? settings.runs : testcases.Count);
                confTester.WaitAction = settings.waitAction;
                confTester.TimeoutAction = settings.timeoutAction;
                confTester.ShowTestCaseCoveredRequirements = settings.showTestCaseCoveredRequirements;
                confTester.showMetrics = settings.showMetrics;

                Symbol waitActionSymbol = confTester.waitActionSet.Choose();
                Symbol timeoutActionSymbol = confTester.timeoutAction.Symbol;

                confTester.ObservableActionSymbols = obs;

                Set<Symbol> cleanup = new Set<string>(settings.cleanupAction).Convert<Symbol>(delegate(string s) { return Symbol.Parse(s); });
                confTester.CleanupActionSymbols = cleanup;

                if (confTester.IsAsync)
                {
                    //remove the wait and timeout action symbol from tester action symbols
                    if (confTester.testerActionSymbols.Contains(waitActionSymbol) ||
                        confTester.testerActionSymbols.Contains(timeoutActionSymbol))
                        confTester.testerActionSymbols =
                            confTester.testerActionSymbols.Remove(waitActionSymbol).Remove(timeoutActionSymbol);
                }

                Set<Symbol> internals = new Set<string>(settings.internalAction).Convert<Symbol>(delegate(string s) { return Symbol.Parse(s); });

                confTester.InternalActionSymbols =
                    (testcases.IsEmpty || settings.startTestAction != "Test" ?
                     internals :
                     internals.Add(Symbol.Parse("Test")));

                TimeSpan timeout = new TimeSpan(0, 0, 0, 0, settings.timeout);
                confTester.TesterActionTimeout = delegate(IState s, CompoundTerm a) { return timeout; };
                confTester.Logfile = settings.logfile;
                confTester.OverwriteLog = settings.overwriteLog;
                if (settings.randomSeed != 0)
                {
                    confTester.RandomSeed = settings.randomSeed;
                }
                #endregion

                //finally, run the application
                confTester.Run();
            }
            catch (ModelProgramUserException)
            {
                throw;
            }
            catch (ConformanceTesterException e)
            {
                throw new ModelProgramUserException(e.Message);
            }
            finally
            {
                if (confTester != null)
                    confTester.Dispose();
            }
        }
        public static void RunWithCommandLineArguments(string[] args)
        {
            //System.Diagnostics.Debugger.Break();
            ConformanceTester confTester = null;
            try
            {

                ConfTesterCommandLineSettings settings = new ConfTesterCommandLineSettings();
                if (!Parser.ParseArgumentsWithUsage(args, settings))
                {
                    //Console.ReadLine();
                    return;
                }

                #region load the libraries
                List<Assembly> libs = new List<Assembly>();
                try
                {
                    if (settings.reference != null)
                    {
                        foreach (string l in settings.reference)
                        {
                            libs.Add(System.Reflection.Assembly.LoadFrom(l));
                        }
                    }
                }
                catch (Exception e)
                {
                    throw new ModelProgramUserException(e.Message);
                }
                #endregion

                #region create the implementation stepper using the factory method
                string implStepperMethodName;
                string implStepperClassName;
                ReflectionHelper.SplitFullMethodName(settings.iut, out implStepperClassName, out implStepperMethodName);
                Type implStepperType = ReflectionHelper.FindType(libs, implStepperClassName);
                MethodInfo implStepperMethod = ReflectionHelper.FindMethod(implStepperType, implStepperMethodName, Type.EmptyTypes, typeof(IStepper));
                IStepper implStepper = null;
                try
                {
                    implStepper = (IStepper)implStepperMethod.Invoke(null, null);
                }
                catch (Exception e)
                {
                    throw new ModelProgramUserException("Invocation of '" + settings.iut + "' failed: " + e.ToString());
                }
                #endregion

                #region create a model program for each model using the factory method and compose into product
                string mpMethodName;
                string mpClassName;
                ModelProgram mp = null;
                if (settings.model != null && settings.model.Length > 0)
                {
                    ReflectionHelper.SplitFullMethodName(settings.model[0], out mpClassName, out mpMethodName);
                    Type mpType = ReflectionHelper.FindType(libs, mpClassName);
                    MethodInfo mpMethod = ReflectionHelper.FindMethod(mpType, mpMethodName, Type.EmptyTypes, typeof(ModelProgram));
                    try
                    {
                        mp = (ModelProgram)mpMethod.Invoke(null, null);
                    }
                    catch (Exception e)
                    {
                        throw new ModelProgramUserException("Invocation of '" + settings.model[0] + "' failed: " + e.ToString());
                    }
                    for (int i = 1; i < settings.model.Length; i++)
                    {
                        ReflectionHelper.SplitFullMethodName(settings.model[i], out mpClassName, out mpMethodName);
                        mpType = ReflectionHelper.FindType(libs, mpClassName);
                        mpMethod = ReflectionHelper.FindMethod(mpType, mpMethodName, Type.EmptyTypes, typeof(ModelProgram));
                        ModelProgram mp2 = null;
                        try
                        {
                            mp2 = (ModelProgram)mpMethod.Invoke(null, null);
                        }
                        catch (Exception e)
                        {
                            throw new ModelProgramUserException("Invocation of '" + settings.model[i] + "' failed: " + e.ToString());
                        }
                        mp = new ProductModelProgram(mp, mp2);
                    }
                }
                #endregion

                #region load the test cases if any
                Sequence<Sequence<CompoundTerm>> testcases = Sequence<Sequence<CompoundTerm>>.EmptySequence;
                if (!String.IsNullOrEmpty(settings.testSuite))
                {
                    try
                    {
                        System.IO.StreamReader testSuiteReader =
                            new System.IO.StreamReader(settings.testSuite);
                        string testSuiteAsString = testSuiteReader.ReadToEnd();
                        testSuiteReader.Close();
                        CompoundTerm testSuite = (CompoundTerm)Term.Parse(testSuiteAsString);
                        foreach (CompoundTerm testCaseTerm in testSuite.Arguments)
                        {
                            Sequence<CompoundTerm> testCase =
                                testCaseTerm.Arguments.Convert<CompoundTerm>(delegate(Term t) { return (CompoundTerm)t; });
                            testcases = testcases.AddLast(testCase);
                        }
                    }
                    catch (Exception e)
                    {
                        throw new ModelProgramUserException("Cannot create test suite: " + e.Message);
                    }
                }
                #endregion

                #region load the fsms if any
                Dictionary<string, FSM> fsms = new Dictionary<string, FSM>();
                if (settings.fsm != null && settings.fsm.Length > 0)
                {
                    try
                    {
                        foreach (string fsmFile in settings.fsm)
                        {
                            System.IO.StreamReader fsmReader = new System.IO.StreamReader(fsmFile);
                            string fsmAsString = fsmReader.ReadToEnd();
                            fsmReader.Close();
                            fsms[fsmFile] = FSM.FromTerm(CompoundTerm.Parse(fsmAsString));
                        }
                    }
                    catch (Exception e)
                    {
                        throw new ModelProgramUserException("Cannot create fsm: " + e.Message);
                    }
                }
                #endregion

                if (mp == null && testcases.IsEmpty && fsms.Count == 0)
                {
                    throw new ModelProgramUserException("No model, fsm, or test suite was given.");
                }

                if (fsms.Count > 0)
                {
                    foreach (string fsmName in fsms.Keys)
                    {
                        ModelProgram fsmmp = new FsmModelProgram(fsms[fsmName], fsmName);
                        if (mp == null)
                            mp = fsmmp;
                        else
                            mp = new ProductModelProgram(mp, fsmmp);
                    }
                }

                #region create the model stepper
                IStrategy ms;

                if (!testcases.IsEmpty)
                {
                    ms = new TestSuiteStepper(settings.startTestAction, testcases, mp);
                }
                else
                {
                    ms = CreateModelStepper(libs, mp, settings.modelStepper, settings.coverage);
                }

                #endregion

                confTester = new ConformanceTester(ms, implStepper);

                #region configure conformance tester settings

                confTester.ContinueOnFailure = settings.continueOnFailure;
                confTester.StepsCnt = (testcases.IsEmpty ? settings.steps : 0);
                confTester.MaxStepsCnt = (testcases.IsEmpty ? settings.maxSteps : 0);
                confTester.RunsCnt = (testcases.IsEmpty ? settings.runs : testcases.Count);
                confTester.WaitAction = settings.waitAction;
                confTester.TimeoutAction = settings.timeoutAction;

                Symbol waitActionSymbol = confTester.waitActionSet.Choose();
                Symbol timeoutActionSymbol = confTester.timeoutAction.FunctionSymbol1;

                Set<Symbol> obs = new Set<string>(settings.observableAction).Convert<Symbol>(delegate(string s) { return Symbol.Parse(s); });
                confTester.ObservableActionSymbols = obs;

                Set<Symbol> cleanup = new Set<string>(settings.cleanupAction).Convert<Symbol>(delegate(string s) { return Symbol.Parse(s); });
                confTester.CleanupActionSymbols = cleanup;

                if (confTester.IsAsync)
                {
                    //remove the wait and timeout action symbol from tester action symbols
                    if (confTester.testerActionSymbols.Contains(waitActionSymbol) ||
                        confTester.testerActionSymbols.Contains(timeoutActionSymbol))
                        confTester.testerActionSymbols =
                            confTester.testerActionSymbols.Remove(waitActionSymbol).Remove(timeoutActionSymbol);
                }

                Set<Symbol> internals = new Set<string>(settings.internalAction).Convert<Symbol>(delegate(string s) { return Symbol.Parse(s); });

                confTester.InternalActionSymbols =
                    (testcases.IsEmpty || settings.startTestAction != "Test" ?
                     internals :
                     internals.Add(Symbol.Parse("Test")));

                TimeSpan timeout = new TimeSpan(0, 0, 0, 0, settings.timeout);
                confTester.TesterActionTimeout = delegate(IState s, CompoundTerm a) { return timeout; };
                confTester.Logfile = settings.logfile;
                confTester.OverwriteLog = settings.overwriteLog;
                if (settings.randomSeed != 0)
                {
                    confTester.RandomSeed = settings.randomSeed;
                }
                #endregion

                //finally, run the application
                confTester.Run();
            }
            catch (ModelProgramUserException)
            {
                throw;
            }
            catch (ConformanceTesterException e)
            {
                throw new ModelProgramUserException(e.Message);
            }
            finally
            {
                if (confTester != null)
                    confTester.Dispose();
            }
        }