Data Driven testing & descriptive programming

5 posts, 0 answers
  1. Naga
    Naga avatar
    15 posts
    Member since:
    Apr 2012

    Posted 09 Apr 2012 Link to this post

    Hello!!!
     I am trying to do feasibility analysis using Test studio.Can anyone let me know how can we achieve parameterization or data driven from an external file.
    2.Can we perform descriptive programming using test studio. for example i have dynamic objects that are populated on the application then
     can i write a driver and store all these elements in a seperate file such as excel and then basing on the requirement can i pass this elemnet as an arguement and perform the operation. If Yes please provide the process as my application has lots of dynamic objects.

    3.How can i write my own code instead of recording.
    4.Where can i find all the methods with which i can write my own code.(An exampke with code would be helpful)
    5.How  can i create reusable functions and call them in my script.All these are application specific reusables such as login.
    6.How can pass the test data to my variables within a script.


    I am very much in need of all these .Your help in this regard would be highly appreciated.

  2. N1t1nA
    N1t1nA avatar
    37 posts
    Member since:
    Mar 2011

    Posted 11 Apr 2012 Link to this post

    Hello Naga 

    Regarding your Points, Please find my comments

    1. how can we achieve parameterization or data driven from an external file. 

    NA
    Here is the article from which you can see,  

    http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/data-driven-testing.aspx 

    You can also download the samples from here 
    http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/code-samples/general/access-sql-database.aspx 

    2. Can we perform descriptive programming using test studio. for example i have dynamic objects that are populated on the application then
     can i write a driver and store all these elements in a seperate file such as excel and then basing on the requirement can i pass this elemnet as an arguement and perform the operation. If Yes please provide the process as my application has lots of dynamic objects 

    NA
    When you add Elements into your Project using Test Studio built in Feature, Add Elements to Project, Test Studio automatically capture the Properties of an Element and Stored in readonly file Pages.g.cs or Pages.g.vb, depends upon the which language you are using for Project(C# or VB), for dynamic elements you can use Advanced Find Logic as mentioned in this article
    http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/elements-pane-overview/find-element.aspx 

    3.How can i write my own code instead of recording. 

    NA
    This is simple, just create a New Test (NewTest1.tstest) and Add Code behind file and start Coding
    http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/coded_steps.aspx 

    4.Where can i find all the methods with which i can write my own code.(An exampke with code would be helpful) 

    NA
    Same as 3

    5.How  can i create reusable functions and call them in my script.All these are application specific reusables such as login. 

    NA
    you can use Modularity Driven approach, Create Common Methods for Lo-gin, Log-out and use them in Test wherever its required
    Here is the Example

    //Log-in Method

    public void LoginToSilverlightClient(string username, string password)

    {

        //Maximize the Browser

        Activebrowser.Window.Maximize();

        //Launch the URL

        Activebrowser.NavigateTo("application url");

        //Wait for UserName Textbox Exists in DOM

        Pages.app.Username.Wait.ForExists(timeout);

        //Enter UserName

        Pages.app.Username.Text = username;

        //Wait for Password Textbox Exists in DOM

        Pages.app.Password.Wait.ForExists(timeout);

        //Enter Password

        Pages.app.Username.Text = password;

        //Wait for Login Button Exists in DOM

        Pages.app.SubmitButton.Wait.ForExists(timeout);

        //Click on Login Button

        Pages.app.SubmitButton.Click(false);

    }


    Access this in Coded Step 
     [CodedStep("Login intoApplication")]
            public void LoginintoYahoo()
            {
                //Create object for Login class
                Login objlogin = new Login();

                //Call the Method to Login into Application
                objlogin.LoginToSilverlightClient("test", "123456");
            }

    6.How can pass the test data to my variables within a script. 

    NA
    Same as 5

    Please let me know if any other info required 

    --Nitin--
    twitter:@N1t1nA
    http://www.linkedin.com/groups/Telerik-Test-Studio-4281132
  3. Anthony
    Admin
    Anthony avatar
    19 posts

    Posted 11 Apr 2012 Link to this post

    @Naga
    Nitin's suggestions are accurate. I'll add to a few of his points, however:

    2. You can find the Add To Project Elements feature on the Elements Menu. Once your elements are in the Elements Explorer, you can easily Reference them in Code.

    4. We have a full Online API Reference, Getting Started with the Testing Framework, and several Code Sample articles.

    5. This is most easily achieved with the Test as Step feature.

    @Nitin
    Thank you for assisting another customer. I awarded you Telerik points for your effort.

     

    Kind regards,
    Anthony
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  4. Mousumi
    Mousumi avatar
    1 posts
    Member since:
    Oct 2013

    Posted 28 Oct 2014 in reply to Anthony Link to this post

    hello Anthony,

    How we ll navigate to yahoo url by calling Login method as we have to pass the url in Login method only. i.e 
    Activebrowser.NavigateTo("application url");


    Thanks,
    Mousumi
  5. Boyan Boev
    Admin
    Boyan Boev avatar
    1040 posts

    Posted 30 Oct 2014 Link to this post

    Hi Mousumi,

    We have already discussed this in your private ticket.

    If you want to execute a coded step in *.tstest your code should look like:

    [CodedStep(@"New Coded Step")]
            public void OpenUrl()
            {
                ActiveBrowser.NavigateTo("http://www.yahoo.com", true);
            }

    If you want to do it in unit test:

    [TestMethod()]
            public void WebTest1()
            {
                // Launch an instance of the browser
                Manager.LaunchNewBrowser();
      
      
                // Navigate to : 'http://www.yahoo.com/'
                ActiveBrowser.NavigateTo("http://www.yahoo.com/", true);
      
      
      
            }


    Hope this helps.

    Regards,
    Boyan Boev
    Telerik
     
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
     
Back to Top