The type or namespace name 'Pages' could not be found

2 posts, 0 answers
  1. Igor
    Igor avatar
    11 posts
    Member since:
    Dec 2010

    Posted 14 Dec 2010 Link to this post

    Hello. I've recorder test from WebUI test studio. It records me like that:

    using Telerik.WebAii.Controls.Html;
    //using Telerik.WebAii.Controls.Xaml;
    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.IO;
     
    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;
     
    namespace SFTQuickStarts_NUnit_CS
    {
     
     
        public class Login : BaseWebAiiTest
        {
            #region [ Dynamic Pages Reference ]
     
            private string loginPage; // path to site
            private string emulatorPath; // path to emulator
            private string credentials; // path to file with credentials
            private string sitePage; // path to file with site page
            private string login;
            private string pass;
            private Pages _pages;
     
            /// <summary>
            /// Gets the Pages object that has references
            /// to all the elements, frames or regions
            /// in this project.
            /// </summary>
            public Pages Pages
            {
                get
                {
                    if (_pages == null)
                    {
                        _pages = new Pages(Manager.Current);
                    }
                    return _pages;
                }
            }
        
            #endregion

    It is working from WebUI studio. Then I moved this code to Visual Studio 2010. The automation library was connected. But

    private Pages _pages;
     
    public Pages Pages
            {
                get
                {
                    if (_pages == null)
                    {
                        _pages = new Pages(Manager.Current);
                    }
                    return _pages;
                }
            }

    are marked as incorrect. After trying to build project I receive the next:

    Error   1   The type or namespace name 'Pages' could not be found (are you missing a using directive or an assembly reference?) C:\Program Files\Telerik\WebUI Test Studio 2010.3\Samples\WebAii Framework\QuickStarts_NUnit_CS\Login.cs    32  17  QuickStarts_NUnit_CS
     
    Error   2   The type or namespace name 'Pages' could not be found (are you missing a using directive or an assembly reference?) C:\Program Files\Telerik\WebUI Test Studio 2010.3\Samples\WebAii Framework\QuickStarts_NUnit_CS\Login.cs    39  16  QuickStarts_NUnit_CS

    Please help me.
  2. Keaegan
    Admin
    Keaegan avatar
    126 posts

    Posted 16 Dec 2010 Link to this post

    Hello Igor,

    I was able to reproduce this issue by doing the following:

    • Convert a test to NUnit
    • Create a new blank test project
    • Copy the converted test to the new blank test project
    • Try to compile

    When you do the above, the pages file is not contained within the new project, so you will run into the described error message (it is being referenced in the .cs or .vb file you are trying to build, but is not present within the project). The Pages.g.cs/vb file must be present in each project within the Solution that is going to use it. To fix this, add an existing item to the project and target the correct pages file for the project (it will be contained in the original Test Project Folder when browsing).

    Regards,
    Keaegan
    the Telerik team

    Interested in Agile Testing? Check out Telerik TV for a recording of Automated Testing in the Agile Environment
Back to Top