AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск Все разделы прочитаны

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 06.06.2012, 23:13   #1  
Blog bot is offline
Blog bot
Участник
 
25,459 / 846 (79) +++++++
Регистрация: 28.10.2006
Dave Froslie: Data driven Coded UI test with Dynamics AX
Источник: http://blogs.msdn.com/b/dave_froslie...namics-ax.aspx
==============

I recently had the need to explore using Visual Studio Coded UI capabilities to create some data in Dynamics AX.  I had never used the data driven test capability in VS and was pleasantly surprised to see how easy it was to use.  Having no experience with data driven tests, I created the following in less than a half hour. and could do it again in just a few minutes now that I know what I’m doing.  Here’s what I did.

First, I created a new test project and a new coded UI test in VS.  I selected “Use Coded UI Test Builder…” to record the steps to create a customer.  The steps were quite straight forward for this prototype.
  1. Select New Customer from the All customers list page.
  2. Enter the Name, Customer group, and Country / region in the Customer – New record form as shown below
  3. Select Save and close.
After recording those steps, I selected Generate code and named the method CreateCustomer.



Now that I have a simple test that will create a single customer, I need to add the data driven aspect of the prototype.  For this I relied on MSDN (http://msdn.microsoft.com/en-us/library/ee624082.aspx) and Mathew Aniyan’s blog post (http://blogs.msdn.com/b/mathew_aniya...-ui-tests.aspx).  This is where the pleasant surprise came as this was very straight forward.

I created an Excel spreadsheet with three columns – CustName, CustGroup, and Region.  I added 10 rows of data to the spreadsheet and saved it as a CSV file.



Following the documentation, I set the Data Connection String attribute to the location of the CSV file using the wizard that came up from the lookup button on the field.  The path to this property is described in the MSDN article referenced above.  The result of this was a new attribute code generated for my test method.

The last step was to map the columns of the spreadsheet to the internal variables used for the fields that I wanted to set.  IntelliSense guided my way, resulting in the test method shown below:

[DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "|DataDirectory|\\CustomerInputs.csv", "CustomerInputs#csv", DataAccessMethod.Sequential), DeploymentItem("DataDrivenCodedUIExample\\CustomerInputs.csv"), TestMethod]

public void CodedUITestMethod1()
{
     this.UIMap.CreateCustomerParams.UINameEditText = TestContext.DataRow["CustName"].ToString();
     this.UIMap.CreateCustomerParams.UICustomergroupEditText = TestContext.DataRow["CustGroup"].ToString();
     this.UIMap.CreateCustomerParams.UICountryregionEditText = TestContext.DataRow["Region"].ToString();
     this.UIMap.CreateCustomer();


}

Running this test walks through the CreateCustomer steps for each row in the spreadsheet, creating 10 new customers in this case.  Now I simply need to modify my spreadsheet to create variations of this data creation exercise!  More typically, the data driven test capability would be used to drive a test case with a variety of inputs to get broader coverage of your application under test.




Источник: http://blogs.msdn.com/b/dave_froslie...namics-ax.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
emeadaxsupport: New Content for Microsoft Dynamics AX 2012 : October 2011 Blog bot DAX Blogs 0 27.10.2011 17:11
Dave Froslie: Visual Studio 10 Coded UI / Action Recordings support for Microsoft Dynamics AX 2012 Blog bot DAX Blogs 0 07.10.2011 21:11
axinthefield: Dynamics AX Event IDs Blog bot DAX Blogs 0 01.03.2011 22:11
daxdilip: Whats New in Dynamics AX 2012 (A brief extract from the recently held Tech Conf.) Blog bot DAX Blogs 7 31.01.2011 12:35
axStart: Microsoft Dynamics AX 2009 Hot Topics Web Seminar Series Blog bot DAX Blogs 0 06.08.2008 12:05
Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 16:04.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.