3 Answers, 1 is accepted
0
Hi Elena,
Thank you for contacting us.
Please elaborate a bit more on your scenario. What do you mean by "modify generated code from one “step” of test"?
Please give us more detailed information.
To see the generated code of the step you just simply need to right click the step and select "Customize step in code".
To see the entire code behind file of the test you should on "View Entire Code Behind File" button. Please see the attached screen shot.
Hope to hear from you soon.
Regards,
Boyan Boev
Telerik
Thank you for contacting us.
Please elaborate a bit more on your scenario. What do you mean by "modify generated code from one “step” of test"?
Please give us more detailed information.
To see the generated code of the step you just simply need to right click the step and select "Customize step in code".
To see the entire code behind file of the test you should on "View Entire Code Behind File" button. Please see the attached screen shot.
Hope to hear from you soon.
Regards,
Boyan Boev
Telerik
0
Elena
Top achievements
Rank 1
answered on 15 Apr 2014, 05:49 AM
See the example:
Steps 7 and 8 in the scenario
is the same, although perform completely different actions (click different
buttons on the toolbar).
Internal code of steps 7, 8 it is absolutely the same.
I'm interested - how to perform different actions.
Where hidden code that is relevant to the operation of the different buttons.
Text of code:
using Telerik.TestingFramework.Controls.KendoUI;
using Telerik.WebAii.Controls.Html;
using Telerik.WebAii.Controls.Xaml;
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;
namespace TestProject2
{
//
// 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
//
ActiveBrowser.NavigateTo("http://www.google.com");
//
// // Or
//
ActiveBrowser.NavigateTo(Data["url"]);
// }
//
public class Long : BaseWebAiiTest
{
#region [ Dynamic Pages Reference ]
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
}
}
Steps 7 and 8 in the scenario
is the same, although perform completely different actions (click different
buttons on the toolbar).
Internal code of steps 7, 8 it is absolutely the same.
I'm interested - how to perform different actions.
Where hidden code that is relevant to the operation of the different buttons.
Text of code:
using Telerik.TestingFramework.Controls.KendoUI;
using Telerik.WebAii.Controls.Html;
using Telerik.WebAii.Controls.Xaml;
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;
namespace TestProject2
{
//
// 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
//
ActiveBrowser.NavigateTo("http://www.google.com");
//
// // Or
//
ActiveBrowser.NavigateTo(Data["url"]);
// }
//
public class Long : BaseWebAiiTest
{
#region [ Dynamic Pages Reference ]
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
}
}
0
Hi Elena,
I cannot see the code for those steps in the code you have provided.
Basically in this case Test Studio performs exactly the same action, however against different elements.
Each element has a different find expression.
Here is an article which describes how you can check/edit the find expression.
What happens when you execute the test. Does it click on the same button or it executes correctly.
Hope this helps.
Regards,
Boyan Boev
Telerik
I cannot see the code for those steps in the code you have provided.
Basically in this case Test Studio performs exactly the same action, however against different elements.
Each element has a different find expression.
Here is an article which describes how you can check/edit the find expression.
What happens when you execute the test. Does it click on the same button or it executes correctly.
Hope this helps.
Regards,
Boyan Boev
Telerik