Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This post will show you how to imbed code into a property value. There are 2 built in macro’s that you can set as the value for a property. They are RandomInt and RandomDouble. These will execute System.Random.Next or System.Random.NextDouble. Here is more info on that class: https://msdn.microsoft.com/en-us/library/system.random_methods.aspx
To use these macros you would do the following:
1) Open a web test
2) Go to a query or form post parameter
3) Set the value of the parameter to either {{$RandomInt(0,10}} or {{$RandomDouble(0,10)}}
4) Execute the test
5) Then in the result, look for the parameter and verify that the value has been set according to your parameters.
A very useful macro plugin has been written and shared on codeplex. Here is a link to the codeplex site: https://www.codeplex.com/UKVSTS/Wiki/View.aspx?title=UKVSTS%20Web%20Test%20Plug%20In&referringTitle=Home
This is a very cool plugin allows you to put almost any code block right in the property value. For example, here are some samples from the codeplex site:
- <% = DateTime.Now %> - for the current date and time
- <% = DateTime.Now.ToString ("dd-MM-yyyy") %> - for the current date and time in the specified format
- <% = Guid.NewGuid() %> - for a new GUID
Comments
Anonymous
December 16, 2008
This post will show you how to imbed code in a paratmer value of a web test without having to createAnonymous
December 16, 2008
This post will show you how to imbed code in a parameter value of a web test without having to create