Issue with Pages.g.cs file

8 posts, 0 answers
  1. Prashant
    Prashant avatar
    20 posts
    Member since:
    Nov 2010

    Posted 11 May 2011 Link to this post

    Hi ,

    We are facing one issue with Pages.g.cs file. We 4 people are working on project. Everyone is assigned with some task to automate.
    Everyone is working on their individual machine.

    After completing our task we tried to club all the Automation test cases created by individual in same test project in VSTS.
    But while adding existing test case in VSTS 2010 we are getting exception - object reference not found for all customised steps.



    Thanks,
    Madhav.
  2. Konstantin Petkov
    Admin
    Konstantin Petkov avatar
    1911 posts

    Posted 12 May 2011 Link to this post

    Hello Madhav,

    This is a typical scenario we should support without troubles. Can you please post the exact stack trace of the error? It may help us find what's going on, thanks!

    Best wishes,
    Konstantin Petkov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  3. Prashant
    Prashant avatar
    20 posts
    Member since:
    Nov 2010

    Posted 13 May 2011 Link to this post

    Hi,
    I am getting following error message while building the solution -

    Error 1 'iRelexUIAutomationTest.Pages.Relex20111Page.SilverlightAppElement' does not contain a definition for 'Item0Button1' and no extension method 'Item0Button1' accepting a first argument of type 'iRelexUIAutomationTest.Pages.Relex20111Page.SilverlightAppElement' could be found (are you missing a using directive or an assembly reference?) F:\Updated Workspace\iRelexUIAutomationTest\iRelexUIAutomationTest\Start Page\Start_Page_Customize.aii.cs 76 45 iRelexUIAutomationTest




    Thanks,
    Madhav

  4. Konstantin Petkov
    Admin
    Konstantin Petkov avatar
    1911 posts

    Posted 13 May 2011 Link to this post

    Hello Madhav,

    That doesn't say much to be honest but I have an idea that might help. Would you please try our latest internal build available at your account here and share with us if that helps? We've addressed some coded tests problems with the latest build.

    Looking forward to hearing from you,
    Konstantin Petkov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  5. Prashant
    Prashant avatar
    20 posts
    Member since:
    Nov 2010

    Posted 13 May 2011 Link to this post

    Hi,

    We are using latest build of Telerik developer edition. Here are the steps to reproduce this issue -
    1) In Computer 1, Create new VSTS Test project.
    2) Create new Web aii Test case. Record any UI.
    3) In Computer 2, Create new VSTS Test project.
    4) Create new Web aii Test case. Record any UI. Convert any one step into Coded step (using Customise step in code).
    5) Now In Computer 1, Copy the test case created on Computer 2.
    6) In Computer 1 open the VSTS. Try to add the existing test case created on Computer 2 in Test project.
    7) You will get follwing error message while building the Test project-

    Error 1 'iRelexUIAutomationTest.Pages.Relex20111Page.SilverlightAppElement' does not contain a definition for 'Item0Button1' and no extension method 'Item0Button1' accepting a first argument of type 'iRelexUIAutomationTest.Pages.Relex20111Page.SilverlightAppElement' could be found (are you missing a using directive or an assembly reference?) F:\Updated Workspace\iRelexUIAutomationTest\iRelexUIAutomationTest\Start Page\Start_Page_Customize.aii.cs 76 45 iRelexUIAutomationTest

    It means the Object we have recorded on Computer 2 is not added in Pages.g.cs file of computer1.


    Thanks,
    Madhav.

  6. Konstantin Petkov
    Admin
    Konstantin Petkov avatar
    1911 posts

    Posted 16 May 2011 Link to this post

    Hi Madhav,

    Thanks for explaining your team workflow.

    Let me start by pointing to the way we generate the Pages file. This file is automatically generated on project build. It shouldn't be included in the project and does not need to.

    Please keep in mind you cannot merge two or more projects into one by adding code from one project to another. This is because of the namespaces which are unique to each project. That is a general requirement not related to Test Studio.

    So the way we recommend resolving such problems is by using one and the same test project across the team. Each team member can work on their test cases independently but you need to work over one and the same project. This typically comes along with source control like TFS in Visual Studio. So if you have your project in TFS everyone can add/edit their tests and check in back the updated ones into TFS. The next team member will get latest and update tests also as needed.

    Again, this is the correct workflow for a team work in general.

    Last, but not least (and this is specific to Test Studio), please also make sure all members of the team run one and the same version of the product. This will avoid hitting some troubles since we constantly improve Test Studio but some changes will make a test project incompatible with previous version, e.g. upgrading to the latest won't let you run the same project in a previous version anymore (we automatically do a backup of the project just in case but we treat it as another project).

    I hope this helps! If you have further questions please do not hesitate to write back.

    Best wishes,
    Konstantin Petkov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  7. Sreedevi
    Sreedevi avatar
    4 posts
    Member since:
    Sep 2011

    Posted 20 Oct 2011 Link to this post

    Konstantin Petkov ,

    Same issue we are also facing .

    Here we are using TFS as a project repository,but when i get latest version i am getting hundreds of errors.it is taking lots of time to handle these issues.
  8. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 20 Oct 2011 Link to this post

    Hi Sreedevi,

    Merging tests from two different test that include coded steps from two different test projects is not officially supported. It can be done but you must take additional steps beyond just copying the files from one project into another.

    The problem is the Namespace declaration that is placed at the beginning of code behind file. Here's an example of the top few lines of a typical .cs code behind file:

    using System;
    using System.Collections.Generic;
    using System.Text;
     
    using ArtOfTest.Common.UnitTesting;
    using ArtOfTest.WebAii.Core;
    using ArtOfTest.WebAii.Controls.HtmlControls;
    using ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts;
    using ArtOfTest.WebAii.Design;
    using ArtOfTest.WebAii.Design.Execution;
    using ArtOfTest.WebAii.ObjectModel;
    using ArtOfTest.WebAii.Silverlight;
    using ArtOfTest.WebAii.Silverlight.UI;
    using Telerik.WebAii.Controls.Html;
    using Telerik.WebAii.Controls.Xaml;
    using System.IO;
     
    namespace TestProject1
    {

    Test Studio will set the namespace to be the same as the name of the test project. As a result, all the Pages.xxxxx references are expecting the Pages.g.cs to be placed into this namespace. Since the Pages.g.cs file is automatically generated by Test Studio it will always be given a namespace declaration for the current test project. This is where the conflict occurs. Your Pages.g.cs file will have namespace TestProject2 while your imported code behind file will have namespace TestProject1. As a result it cannot find the objects declared in Pages.g.cs having a different namespace declaration.

    If you update the namespace declaration of your imported .cs files it should fix the compile problems you are running into when you attempt to merge tests from multiple test projects into one test project.

    You would actually be better off by following these steps:

    1) Create new test project on computer A
    2) Check in the test project into TFS
    3) Computer B gets the latest to get the new test project out of TFS
    4) Now both computer A and computer B can work in the same test project at the same time. The only caveat is each developer must not work on the same single test at the same time (it is not possible to merge changes made by two developers on the same single test). It's perfectly OK to work on different tests within the same test project at the same time.

    All the best,
    Cody
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top
  Cast Your Vote at DevPro Connections! Cast Your Vote at  Win IT Pro Connections!