コード例 #1
0
ファイル: Client.cs プロジェクト: sadstorm/LoadTester112
        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;
        }
コード例 #2
0
ファイル: CloseCard.cs プロジェクト: sadstorm/LoadTester112
 public CloseCard(int callsToClose, CardTest parent)
 {
     _callsToCard = callsToClose;
       _parent = parent;
 }
コード例 #3
0
ファイル: SaveCard.cs プロジェクト: sadstorm/LoadTester112
 public SaveCard(CardTest parent, CardSaveTestConfig cfg)
 {
     _parent = parent;
       _cfg = cfg;
 }
コード例 #4
0
ファイル: OpenCard.cs プロジェクト: sadstorm/LoadTester112
 public OpenCard(CardTest parent)
 {
     _id = Guid.Empty;
       _parent = parent;
 }