How can I pass in the current datetime parameter to a SOAP request? I know you can pass in parameters by开发者_开发百科 adding a datasource to the web test project and reference it like this {{DataSource.TableName.FieldName}}.
But I want to pass in current datetime parameter as a dynamic value (something like DateTime.Now). How do I go about doing this? Below is sample SOAP request that I put into String Body:
<soap:body>
<MyQuery xmlns="http://something.com">
<req>
<QueryType>{{DataSource.Table.QueryType}}</QueryType>
<Name>{{DataSource.Table.Name}}</Name>
<RequestDateTime>{{insert DateTime.Now here}}</RequestDatetime>
</req>
</MyQuery>
</soap:body>
P.S. Running web test by adding Web Service Request in Visual Studio Team System 2008
Convert it to a coded test. Easy enough to add a Datetime.Now.ToString(format) call.
精彩评论