This is a migrated thread and some comments may be shown as answers.

Issue with Pages.g.cs file

7 Answers 413 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Prashant
Top achievements
Rank 1
Prashant asked on 11 May 2011, 11:43 AM
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.

7 Answers, 1 is accepted

Sort by
0
Konstantin Petkov
Telerik team
answered on 12 May 2011, 07:39 AM
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 >>

0
Prashant
Top achievements
Rank 1
answered on 13 May 2011, 11:38 AM

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

0
Konstantin Petkov
Telerik team
answered on 13 May 2011, 11:48 AM
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 >>

0
Prashant
Top achievements
Rank 1
answered on 13 May 2011, 12:36 PM
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.

0
Konstantin Petkov
Telerik team
answered on 16 May 2011, 09:16 AM
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 >>

0
Sreedevi
Top achievements
Rank 1
answered on 20 Oct 2011, 02:30 PM
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.
0
Cody
Telerik team
answered on 20 Oct 2011, 06:10 PM
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.
Tags
General Discussions
Asked by
Prashant
Top achievements
Rank 1
Answers by
Konstantin Petkov
Telerik team
Prashant
Top achievements
Rank 1
Sreedevi
Top achievements
Rank 1
Cody
Telerik team
Share this question
or