Пример #1
0
 void TestStarting(object sender, TestStartingEventArgs e)
 {
     foreach (string key in LoadTest.Context.Keys)
     {
         e.TestContextProperties.Add(key, LoadTest.Context[key]);
     }
 }
 private void LoadTest_TestStarting(object sender, TestStartingEventArgs e)
 {
     foreach (var property in _loadTest.Context)
     {
         e.TestContextProperties.Add(property);
     }
 }
        private void TestStarting(object source, TestStartingEventArgs testStartingEventArgs)
        {
            if (vsoTransactionContext.IsSaveTransactionInAzure)
            {
                lock (this)
                {
                    Boolean flag = false;
                    testStartingEventArgs.TestContextProperties.Add("ScenarioName", testStartingEventArgs.TestName);

                    //A generic iterative process where it will manage maxiterationcount and data by dynamically taking the scenario/test method (for New LT framework)
                    for (int i = 0; i < GenericScenarioNameList.Count; i++)
                    {
                        if (GenericScenarioNameList.ContainsKey(testStartingEventArgs.TestName))
                        {
                            if (GenericScenarioNameList[testStartingEventArgs.TestName].scenarioUserCount.ContainsKey(testStartingEventArgs.UserContext.UserId) &&
                                GenericScenarioNameList[testStartingEventArgs.TestName].scenarioUserCount[testStartingEventArgs.UserContext.UserId] != 0)
                            {
                                flag = false;

                                if (GenericScenarioNameList[testStartingEventArgs.TestName].scenarioUserCount[testStartingEventArgs.UserContext.UserId] == GenericScenarioNameList[testStartingEventArgs.TestName].scenarioUserMaxIterationCount)
                                {
                                    flag = true;
                                    GenericScenarioNameList[testStartingEventArgs.TestName].scenarioUserCount[testStartingEventArgs.UserContext.UserId] = 0;
                                }

                                GenericScenarioNameList[testStartingEventArgs.TestName].scenarioUserCount[testStartingEventArgs.UserContext.UserId] += 1;
                            }
                            else
                            {
                                GenericScenarioNameList[testStartingEventArgs.TestName].scenarioUserCount.Remove(testStartingEventArgs.UserContext.UserId);
                                GenericScenarioNameList[testStartingEventArgs.TestName].scenarioUserCount.Add(testStartingEventArgs.UserContext.UserId, 1);
                                flag = true;
                            }

                            testStartingEventArgs.TestContextProperties.Add("iterationNo", GenericScenarioNameList[testStartingEventArgs.TestName].scenarioUserCount[testStartingEventArgs.UserContext.UserId]);
                            testStartingEventArgs.TestContextProperties.Add("maxiterationNo", GenericScenarioNameList[testStartingEventArgs.TestName].scenarioUserMaxIterationCount);
                            //testStartingEventArgs.TestContextProperties.Add("flagCount", GenericScenarioNameList[testStartingEventArgs.TestName].flagCount);
                            break;
                        }
                    }

                    foreach (KeyValuePair <string, object> keyValuePair in m_loadTest.Context)
                    {
                        testStartingEventArgs.TestContextProperties.Add(keyValuePair.Key, keyValuePair.Value);
                    }

                    testStartingEventArgs.TestContextProperties.Add("doLogin", flag);
                    testStartingEventArgs.TestContextProperties.Add("UserId", testStartingEventArgs.UserContext.UserId);
                    int testdetailID = vsoTransactionContext.CntLoadTestDetail;
                    testStartingEventArgs.TestContextProperties.Add("TestDetailID", testdetailID);
                    testStartingEventArgs.TestContextProperties.Add("LoadTestrunID", vsoTransactionContext._loadtestRunID);
                    testStartingEventArgs.TestContextProperties.Add("AgentID", vsoTransactionContext._agentID);
                    vsoTransactionContext.CntLoadTestDetail = testdetailID + 1;
                    testStartingEventArgs.TestContextProperties.Add("TestCaseId", vsoTransactionContext._loadtestTestCase[testStartingEventArgs.TestName].TestCaseId);
                }
            }
        }
Пример #4
0
 void mLoadTest_TestStarting(object sender, TestStartingEventArgs e)
 {
     //When the test starts, copy the load test context parameters to
     //the test context parameters
     foreach (string key in _loadTest.Context.Keys)
     {
         e.TestContextProperties.Add(key, _loadTest.Context[key]);
     }
 }
 void mLoadTest_TestStarting(object sender, TestStartingEventArgs e)
 {
     //When the test starts, copy the load test context parameters to
     //the test context parameters
     foreach (string key in mLoadTest.Context.Keys)
     {
         e.TestContextProperties.Add(key, mLoadTest.Context[key]);
     }
     //add the CurrentTestIteration to the TestContext
     e.TestContextProperties.Add("TestIterationNumber", e.TestIterationNumber);
     //add the TotalIterations to the TestContext and access from the Unit Test.
     e.TestContextProperties.Add("TotalIterations", TotalIterations);
 }
Пример #6
0
 void myLoadTest_TestStarting(object sender, TestStartingEventArgs e)
 {
     myLoadTest.Context["testNumber"] = (int)myLoadTest.Context["testNumber"] + 1;
     e.TestContextProperties["testNumber"] = myLoadTest.Context["testNumber"];
 }
Пример #7
0
 /// <summary>
 /// Pass the values loaded in the pluging to the test context
 /// so that the test methods are able to read the properties
 /// </summary>
 private void TestStarting(object source, TestStartingEventArgs testStartingEventArgs)
 {
     SetTestContextProperties(testStartingEventArgs.TestContextProperties as IDictionary, testStartingEventArgs.ScenarioName);
     testStartingEventArgs.TestContextProperties.Add(SharedConstants.IsLoadTest, "true");
 }