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

Add Code behind file to your test (error)

2 Answers 122 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.
Mostafa
Top achievements
Rank 2
Mostafa asked on 05 Sep 2011, 04:42 PM
hi telerik Team,

I need to evaluate the telerik test studio for possible use with wpf applications.

I now have a problem with the produce of code behind each step.

I do the following steps in the VS-plugin Version:
1) Add code behind file to your test
2) then I get the namespace with a class...(for example: versuchen.tstest.cs)
3) then I make the step: "Customize Step in Code"
4) I get the method in the class (for example: versuchen.tstest.cs) and therefore I have the following result :
using System;
  
using System.Collections.Generic;
  
using System.Text;
  
using System.Linq;
  
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 ArtOfTest.WebAii.Wpf;
  
using Telerik.WebAii.Controls.Html;
  
using Telerik.WebAii.Controls.Xaml;
  
namespace CodeStep
  
{
  
//
  
// You can add custom execution steps by simply
  
// adding a void function and decorating it with the [CodedStep] 
  
// attribute to the test method. 
  
// Those steps will automatically show up in the test steps on save.
  
//
  
// The BaseWebAiiTest exposes all key objects that you can use
  
// to access the current testcase context. [i.e. ActiveBrowser, Find ..etc]
  
//
  
// Data driven tests can use the Data[columnIndex] or Data["columnName"] 
  
// to access data for a specific data iteration.
  
//
  
// Example:
  
//
  
// [CodedStep("MyCustom Step Description")]
  
// public void MyCustomStep()
  
// {
  
// // Custom code goes here
  
// Applications.Spreadsheetexe.Book1__Spreadsheet.InsertTabitem.User.Click(); 
  
// }
  
//
  
  
public class versuchen : BaseWebAiiTest
  
{
  
#region [ Dynamic Applications Reference ]
  
private Applications _applications;
  
/// <summary>
  
/// Gets the Applications object that has references
  
/// to all the elements, windows or regions
  
/// in this project.
  
/// </summary>
  
public Applications Applications
  
{
  
get
  
{
  
if (_applications == null)
  
{
  
_applications = new Applications(Manager.Current);
  
}
  
return _applications;
  
}
  
}
  
#endregion
  
[CodedStep(@"Type 'test' into PasswordTextBoxPasswordbox")]
  
public void versuchen_CodedStep()
  
{
  
// Type 'test' into PasswordTextBoxPasswordbox
  
Applications.WpfClientexe..PasswordTextBoxPasswordbox.SetPassword(true, "test", 10, 100);
  
}
  
  
// Add your test methods here...
  
}
  
}
5) I save it and build the project, then I get the following error: (see  error.7z)
6) and when i execute the steps or the code, i get the following error:

'05.09.2011 17:32:46' - Starting execution....'05.09.2011 17:33:00' - Detected custom code in test. Locating test assembly: CodeStep.dll.'05.09.2011 17:33:00' - Failure detected during execution. Details:
------------------------------------------------------------
'05.09.2011 17:33:00' - System.IO.FileNotFoundException: Unable to find the code behind assembly. Please make sure you have compiled your code behind without errors before attempting to execute the test. Looking for: c:\users\al-jendi\documents\visual studio 2010\Projects\CodeStep\CodeStep\bin\Debug\CodeStep.dllIf you are running VS 2010, make sure Deployment is checked in your .settings file (in the solution items) at ArtOfTest.WebAii.Design.Execution.ExecutionUtils.EnsureAssemblyExists(String assembly, String folder) at ArtOfTest.WebAii.Design.Execution.ExecutionUtils.CreateCodedTestInstance(Test test, TestResult result, String binariesFolder) at ArtOfTest.WebAii.Design.Execution.ExecutionEngine.InternalExecuteTest(Test test, TestResult initializationResult) at ArtOfTest.WebAii.Design.Execution.TestExecuteProxy.ExecuteTest(Test test, Settings settings, String deploymentFolder, String binariesFolder, ExecutionType exeType, Guid firstStepGuid, Guid lastStepGuid, IntPtr existingBrowserHandle, DebuggerOptions debuggerOptions)
------------------------------------------------------------
'05.09.2011 17:33:01' - Test completed!

Thanks Telerik Team

2 Answers, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 07 Sep 2011, 03:22 AM
Hello Mostafa,

I just had another customer get the same compilation error that you reported. The problem is caused by one of your Window nodes not having a FriendlyName to be used in the auto-generated Pages.g.cs file. Specify a FriendlyName and the problem will be solved (see attached screen shot).

Kind regards,
Cody
the Telerik team
Vote for Telerik Test Studio at the Annual Automation Honors Voting!
0
Mostafa
Top achievements
Rank 2
answered on 09 Sep 2011, 12:19 PM
Thanks for your help,

Tags
General Discussions
Asked by
Mostafa
Top achievements
Rank 2
Answers by
Cody
Telerik team
Mostafa
Top achievements
Rank 2
Share this question
or