Exemplo n.º 1
0
        private void CreateEventsList(TestConfig test)
        {
            List<string> list = new List<string>();
              list.Add(ConditionConverter.ToText(Condition.TimeInterval));
              switch (test.GetType().Name)
              {
            case "CardListTestConfig":
            case "CardTestConfig":
              list.Add(ConditionConverter.ToText(Condition.WhenCallComes));
              list.Add(ConditionConverter.ToText(Condition.WhenCallEstablished));
              list.Add(ConditionConverter.ToText(Condition.WhenCallCommited));
            break;

            case "RelevantCardListTestConfig":
              list.Add(ConditionConverter.ToText(Condition.WhenCallEstablished));
            break;

            case "IncidentTypeChoiceTestConfig":
              list.Add(ConditionConverter.ToText(Condition.WhenCallEstablished));
            break;

              }
              comboBox1.DataSource = list;
              if (list.Count == 1)
            comboBox1.Enabled = false;
        }
Exemplo n.º 2
0
        private bool AddTest(TestManager parent, TestConfig testConfig)
        {
            TestBase test = null;
              var timeInterval = GetFromTemplate(testConfig.TimeIntervalTemplate, _id);
              int ti = 0;

              Int32.TryParse(timeInterval, out ti);
              testConfig.TimeInterval = ti;

              switch (testConfig.GetType().Name)
              {
            case "LoopConfig":
              var cfgLoop = testConfig as LoopConfig;
              test = new TestManager(testConfig.Name) { StartCondition = cfgLoop.StartCondition, Delay = cfgLoop.TimeInterval, Iterations = cfgLoop.Iterations, StopOnError = cfgLoop.StopOnError, NotifyWhenIterationFinished = cfgLoop.NotifyWhenIterationFinished, StatisticsGatherer = ClientStatisticsGatherer };
              cfgLoop.Tests.ForEach(d=>AddTest(test as TestManager, d));
            break;

            case "LoginTestConfig":
              var cfgLogin = testConfig as LoginTestConfig;
              _login = GetFromTemplate(cfgLogin.LoginTemplate, _id);
              TestStaticDataMng.Register(_login);
              var passwd = CreatePassword(_login);
              test = new LoginTest(_login, passwd) { StartCondition = cfgLogin.StartCondition, Delay = cfgLogin.TimeInterval, StatisticsGatherer = ClientStatisticsGatherer };
            break;

            case "TotalCardListTestConfig":
              var cfgTotalCardListTest = testConfig as TotalCardListTestConfig;
              test = new TotalCardListTest(cfgTotalCardListTest.NumItemsOnPage) { StartCondition = cfgTotalCardListTest.StartCondition,Delay = cfgTotalCardListTest.TimeInterval, StatisticsGatherer = ClientStatisticsGatherer };
            break;

            case "RelevantCardListTestConfig":
              var cfgRelevantCardListTest = testConfig as RelevantCardListTestConfig;
              test = new RelevantCardListTest(cfgRelevantCardListTest.NumItemsOnPage) { StartCondition = cfgRelevantCardListTest.StartCondition,Delay = cfgRelevantCardListTest.TimeInterval, StatisticsGatherer = ClientStatisticsGatherer };
            break;

            case "IncidentTypeChoiceTestConfig":
              var cfgIncidentTypeChoice = testConfig as IncidentTypeChoiceTestConfig;
              test = new IncidentTypeChoiceTest(cfgIncidentTypeChoice.IncidentTypeName, cfgIncidentTypeChoice.NumItemsOnPage) { StartCondition = cfgIncidentTypeChoice.StartCondition, Delay = cfgIncidentTypeChoice.TimeInterval, StatisticsGatherer = ClientStatisticsGatherer };
            break;

            case "LogoutTestConfig":
              var cfgLogout = testConfig as LogoutTestConfig;
              test = new LogoutTest { StartCondition = cfgLogout.StartCondition, Delay = cfgLogout.TimeInterval, StatisticsGatherer = ClientStatisticsGatherer };
            break;

            case "CardListTestConfig":
              var cfgCardList = testConfig as CardListTestConfig;
              test = new CardListTest(cfgCardList.NumberOfPageChanging, ClientStatisticsGatherer) { StartCondition = cfgCardList.StartCondition, Delay = cfgCardList.TimeInterval };
            break;

            case "CardTestConfig":
              var cfgCard = testConfig as CardTestConfig;
              test = new CardTest(ClientStatisticsGatherer) { StartCondition = cfgCard.StartCondition, Delay = cfgCard.TimeInterval,  };
              cfgCard.Tests.ForEach(d => AddTest(test as TestManager, d));
            break;

            case "CardSaveTestConfig":
              var cfgSave = testConfig as CardSaveTestConfig;
              if (!(parent is CardTest)) return false;
              test = new SaveCard(parent as CardTest, cfgSave) { StartCondition = cfgSave.StartCondition, Delay = cfgSave.TimeInterval, StatisticsGatherer = ClientStatisticsGatherer };
            break;

            case "CardCloseTestConfig":
              var cfgClose = testConfig as CardCloseTestConfig;
              if (!(parent is CardTest)) return false;
              test = new CloseCard(cfgClose.CallsToCard, parent as CardTest ) { StartCondition = cfgClose.StartCondition, Delay = cfgClose.TimeInterval, StatisticsGatherer = ClientStatisticsGatherer };
              break;

            case "WaitCallConfig":
              var wcCfg = testConfig as WaitCallConfig;
              test = new WaitCall(wcCfg.CallCommitCondition, wcCfg.CommitPause, wcCfg.AcceptCalls, wcCfg.RejectCalls, wcCfg.NoAnswer, Data) { StartCondition = wcCfg.StartCondition, Delay = wcCfg.TimeInterval, StatisticsGatherer = ClientStatisticsGatherer };
            break;
              }

              if (parent == null)
              {
            _testMng = test as TestManager;
              }
              else
              {
            parent.AddTest(test);
              }

              return true;
        }
Exemplo n.º 3
0
        private void AddNode(TreeNode parent, TestConfig testConfig)
        {
            TreeNode node = new TreeNode(testConfig.Name);
              node.Tag = testConfig;

              if(testConfig.GetType().Name == "LoopConfig" || testConfig.GetType().Name == "CardTestConfig" )
              {
            ((LoopConfig)testConfig).Tests.ForEach(d=>AddNode(node, d));
              }

              if (parent == null)
            treeView1.Nodes.Add(node);
              else
            parent.Nodes.Add(node);
        }