public Client(int id, Config cfg, SynchronizationContext ctx) { ClientStatisticsGatherer = new ClientStatisticsGatherer(); _ctx = ctx; _id = id; Data = new TestData(this); IsStopped = false; _log = LogManager.GetLogger("Client_" + _id); _log.Debug("Client created"); Configure(cfg); if (String.IsNullOrEmpty(_login)) { const string err = "Login command is not specified!!! Can't do any test."; _log.Error(err); throw new Exception(err); } _ajaxHelper = new AjaxHelper(new AjaxConn(_login, cfg.ServerIp, cfg.AjaxPort, _ctx)); _webSock = new WebSockConn(_login, cfg.ServerIp, cfg.WsPort, ctx); _webSock.CcsStateChanged += WsOnCcsStateChanged; _webSock.InitializationFinished += () => _testMng.GetTest<LoginTest>().OnClientInitialized(); _testMng.SetEnv(_login, _ajaxHelper.AjaxConn, _webSock); }
public ClientMng(SynchronizationContext ctx, Config cfg) { _ctx = ctx; Config = cfg; Clients = new List<Client>(); }
public void Generate() { Config = new Config(); LoopConfig root = Config.Tests; root.Iterations = 1; root.StopOnError = true; root.Name = "Root"; LoginTestConfig loginTest = new LoginTestConfig(); loginTest.LoginTemplate = "xxxx"; root.Tests.Add(loginTest); ConfigurationTestConfig configuration = new ConfigurationTestConfig{ Name = "Configuration" }; root.Tests.Add(configuration); TotalCardListTestConfig totalCardListTest = new TotalCardListTestConfig { Name = "TotalCardList" }; root.Tests.Add(totalCardListTest); LoopConfig waitCallLoop = new LoopConfig { Iterations = 1, Name = "WaitCallLoop", StopOnError = false }; root.Tests.Add(waitCallLoop); WaitCallConfig waitCall = new WaitCallConfig { StartCondition = Condition.TimeInterval, TimeInterval = 10000 }; waitCall.AcceptCalls = true; waitCall.CallCommitCondition = Condition.WhenIterationFinished; waitCallLoop.Tests.Add(waitCall); LoopConfig mainLoop = new LoopConfig { Iterations = -1, Name = "MainLoop", StopOnError = true, NotifyWhenIterationFinished = true }; root.Tests.Add(mainLoop); RelevantCardListTestConfig relevantCardListTest = new RelevantCardListTestConfig { Name = "RelevantCardList", StartCondition = Condition.WhenCallEstablished, NumItemsOnPage = 20 }; mainLoop.Tests.Add(relevantCardListTest); IncidentTypeChoiceTestConfig incidentTypeChoice = new IncidentTypeChoiceTestConfig { Name = "IncidentTypeChoice", StartCondition = Condition.TimeInterval, TimeInterval = 1, NumItemsOnPage = 20}; mainLoop.Tests.Add(incidentTypeChoice); CardTestConfig cardTest = new CardTestConfig { StartCondition = Condition.TimeInterval, TimeInterval = 1 }; cardTest.Tests.Add(new CardSaveTestConfig { StartCondition = Condition.TimeInterval, TimeInterval = 5000 }); cardTest.Tests.Add(new CardCloseTestConfig { CallsToCard = 0, StartCondition = Condition.TimeInterval, TimeInterval = 5000 }); mainLoop.Tests.Add(cardTest); mainLoop.Tests.Add(new CardListTestConfig { NumberOfPageChanging = 2, StartCondition = Condition.TimeInterval, TimeInterval = 2000}); }
private bool Configure(Config cfg) { AddTest(null, cfg.Tests); return true; }
private void Init(Config cfg) { _log.Debug("Start requested"); if (_state == State.InWork || _state == State.Stopping) { _log.Warn("Try to start when in work. Ignore."); return; } _state = State.InWork; _log.Debug("Current state is 'in work'. Start adding clients."); for (int i = cfg.StartFrom; i < cfg.StartFrom + cfg.ClientNum; ++i) { var client = new Client(i, cfg, _ctx); client.Stopped += CheckIfAllStopped; Clients.Add(client); } _log.Debug("All clients added. Started OK!"); }
public void ClearConfig() { Config = new Config(); Save(); }
public void Update() { Config = GetConfigCopy(); }
private void btnGenerate_Click(object sender, EventArgs e) { _cfgMng.ClearConfig(); _cfgMng.Generate(); Config = _cfgMng.Config; UpdateView(); }