Implementing Page-Object-Model in Telerik Teststudio

4 posts, 0 answers
  1. sai
    sai avatar
    1 posts
    Member since:
    Jun 2015

    Posted 30 Jun 2015 Link to this post

    Hi Telerik Team,

     

        I'm working on Telerik Teststudio latest version 2015.1.139 (Visual studio plug-in) and visual studio community 2013 win7  in my Local system.

        I'm trying to implement Page object model for Telerik teststudio as in selenium . I've done this successfully using Telerik Testing Framework by installing the TTF_Ultimate and work around.

        Now,Im trying to implement the same in Teststudio using Record and play back approach . I've taken the sample scenerio of Gmail Login 

        1. I've taken the Locators like "Pages.Gmail.EmailEmail" in Constants.tstest.cs generated after adding to element repository

        2.Taken the other webtest "GmailLogin.tstest.cs" and called a method _gmailObject.GmailLogin();

        3. I've implemented the actions in  GmialLogin() in "Methods.tstest.cs"  , I've defined all the User actions as reusable methods in "UserActions.tstest.cs"

       4. I'm able to access most of the reusable safe actions defined in UserActions from GmailLogin() in "Methods.tstest.cs" as UAobj.Click(Html Locator); 

       5. However I'm not able to enter the text in fields using this way by calling safe actions from GmailLogin() but its working fine when I'm running from testcase using Quick execute "GmailLogin.tstest." and I'm also able to enter the text using codedstep() ie script step but not with the function calls defined .I'm getting the exception evry time while entering the text as "Null reference exception:Object reference not set to an instance of an object"  at Actions.settext(Pages.Gmail.EmailEmail,"k.srikanth");

    Please tell me is there any dependencies with this I've tried in different ways but not able to enter the text the other actions are working fine.

    Please find the attached project and provide me a solution ASAP. Thanks in advance

    Execute GmailLogin.tstest under "TestSuites" folder under Project/solution to encounter the issue 

     

    Thanks,

    sai

     

     

          

  2. Konstantin Petkov
    Admin
    Konstantin Petkov avatar
    1911 posts

    Posted 03 Jul 2015 Link to this post

    Hi sai,

    I think I understand the problem. You're basically trying to implement the Browser.Actions however the actual Actions is for internal use and not exposed to implement publicly. Internally we implement Browser Actions for each browser specifics. Each action basically calls the browser using the Browser instance passed internally. This fails in your code with the TypeText call because your UserActions don't include the browser instance. That is why you get the NullReference.

    I'm afraid this scenario is not supported. I'm sorry for any caused inconvenience!

    Regards,
    Konstantin Petkov
    Telerik
     
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
     
  3. uday
    uday avatar
    10 posts
    Member since:
    Aug 2015

    Posted 08 Sep 2015 in reply to Konstantin Petkov Link to this post

    Hi Petkov,

     

       Thanks for your response, I've two questions 

    1.You've said that safeActions does not include the browser instance and for this reason I'm getting null exception but I wonder how my SafeAction Click() is working fine even though I've not passed any browser instance to SafeActions class.

    2.I've tried creating the new object for browser instance to SafeActions but couldnt able to create object and end up with errors .Please suggest if I'm missing something or suggest me how to create the instance to solve this problem.

            Show me If there is any alternative on behalf this , Thanks in Advance.

     

    Regards,

    Uday.

  4. Konstantin Petkov
    Admin
    Konstantin Petkov avatar
    1911 posts

    Posted 11 Sep 2015 Link to this post

    Hello,

    I don't know what SafeActions is, I don't see it in the original attached solution.

    The TypeText is a method of BaseWebAiiTest.Actions class whereas the click is based on HtmlControl.Click method. They handle the active browser instance they work base on in a different ways. There is no public API to correct the browser instance in the first approach that is why I explained this approach is not supported.

    Please use the ActiveBrowser.Actions instead. Here is sample code on the matter:
    http://docs.telerik.com/teststudio/testing-framework/automate-browser-actions

    Regards,
    Konstantin Petkov
    Telerik
     
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
     
Back to Top
  Cast Your Vote at DevPro Connections! Cast Your Vote at  Win IT Pro Connections!