Code analysis of the Test Project in CodedUi Testing in VSTS

Code analysis of the Test Project using the LogIntoGmail Scenario Automation

CodedUiTestcaseID_1.cs File
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Windows.Input;
using System.Windows.Forms;
using System.Drawing;
using Microsoft.VisualStudio.TestTools.UITesting;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.VisualStudio.TestTools.UITest.Extension;
using Keyboard = Microsoft.VisualStudio.TestTools.UITesting.Keyboard;


namespace TestGmail
{
    /// <summary>
    /// Summary description for CodedUITest1
    /// </summary>
    [CodedUITest]
    public class CUI_TestCaseID_1
    {
        public CUI_TestCaseID_1()
        {
        }

        [DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "|DataDirectory|\\GlobalParams.csv", "GlobalParams#csv", DataAccessMethod.Sequential), DeploymentItem("TestGmail\\GlobalParams.csv"), TestMethod]
        public void LoggingIntoGmail()
        {
            // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
            // For more information on generated code, see http://go.microsoft.com/fwlink/?LinkId=179463

            // overriding the values of the record time.
            //this.UIMap.LogIntoGmailParams.UIEmailEditText = "viplav15";
            //this.UIMap.LogIntoGmailParams.UIPasswdEditPassword = Playback.EncryptText("xyz");
           
            // After Externalising by CSV File
            this.UIMap.LogIntoGmailParams.UIEmailEditText = TestContext.DataRow["UserId"].ToString();
            this.UIMap.LogIntoGmailParams.UIPasswdEditPassword = Playback.EncryptText(TestContext.DataRow["Password"].ToString());
          

            //this.UIMap.LogIntoGmail();

            // synchronizing the Script playback with Site Loading time
            Playback.Wait(5000);
            WaitForReadyLevel.AllThreads.ToString();

            // Overrididng the content globally So that we can call the functions in more robust a manner +
        

            this.UIMap.SignIntoGmailGlobal(TestContext );
           

            // Validate the User Login Information
            //this.UIMap.ValidateUesrDetailsExpectedValues.UIGuserPaneInnerText = "viplav15@gmail.com";

            // Validate the User Login Information using Data Driven Automation Testing : UserInfo is the column in the csv file having the info to be validated
            this.UIMap.ValidateUesrDetailsExpectedValues.UIGuserPaneInnerText = TestContext.DataRow["UserInfo"].ToString();

            this.UIMap.ValidateUesrDetails();
        }

        #region Additional test attributes

        // You can use the following additional attributes as you write your tests:

        ////Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{       
        //    // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
        //    // For more information on generated code, see http://go.microsoft.com/fwlink/?LinkId=179463
        //}

        ////Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{       
        //    // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
        //    // For more information on generated code, see http://go.microsoft.com/fwlink/?LinkId=179463
        //}

Post a Comment

Previous Post Next Post