Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Coded UI tests can be data driven, that is often thought of as getting data from a data file such as a CSV file or a spread sheet. But the ideas of data driving can be used in other ways. Your tests need one part of data driving but the data source is the system clock.</p> <p>When you record part of a test and save it as a method, any values entered are used as the initial values of fields in a class with a name based on the method name. For an action method named <code>MyMethod</code> the class will be <code>MyMethodParams</code>. For a method that checks assertions in method named <code>MyAssertion</code> the class will be <code>MyAssertionExpectedValues</code>. When the method runs it uses values from the <code>...Params</code> or the <code>...ExpectedValues</code> class. These values can be overwritten before calling the method.</p> <p>For your test where each execution of the test should use a different date and time you can write code such as</p> <pre><code>MyMethodParams.DateField = DateTime.Now.AddDays(90).ToString("MM/dd/yyyy"); MyMethodParams.TimeField = DateTime.Now.ToString("HH:mm:ss.fff"); MyMethod(); </code></pre> <p>If each test iteration requires a different date then you could add the test iteration number to the <code>90</code> used above. The iteration could easily be counted via a <code>static int</code> of the class.</p> <p>The Coded UI content index has links to data driving Coded UI tests and to many other useful topics. See <a href="http://blogs.msdn.com/b/mathew_aniyan/archive/2013/02/18/content-index-for-coded-ui-test.aspx" rel="nofollow">http://blogs.msdn.com/b/mathew_aniyan/archive/2013/02/18/content-index-for-coded-ui-test.aspx</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload