我正在测试一个API,我希望使用类来定义我的有效负载,这样我的程序就可以反序列化/序列化成任何格式(在我的例子中就是XML )。下面是有效载荷的一个示例:
<Order>
<BillingAddress>
<AddressLine1></AddressLine1>
<AddressLine2></AddressLine2>
<City></City>
</BillingAddress>
<Items>
<Item IsKit="false">
<CountryVATRate></CountryVATRate>
<Group></Group>
<Reference></Reference>
</Item>
<Item IsKit="false">
<CountryVATRate>0.25</CountryVATRate>
<Group>5360693120</Group>
<Reference>5360693120</Reference>
</Item>
</Items>
<OrderAmount>35</OrderAmount>
<TimeStamp>2017-03-30 00:00:00.102</TimeStamp>
</Order>因此,我的想法是,我将有一个总体秩序类,如下所示
public class Order()
{
BillingAddress bAddr; //another class
List Items;
double OrderAmount;
DateTime TimeStamp;
}我正在尝试的是设置框架的最佳方法,以便在BillingAddress类的示例中,我可以设置一系列属性,例如AddressLine1/AddressLine1等,然后在运行测试时调用这些属性。
任何关于如何构造测试框架的建议都将不胜感激。
发布于 2018-10-04 21:08:46
我不确定它在C#中是如何工作的,但是您可以使用可选参数。此外,我建议创建一个有效载荷模型。-模型-> - xml - xml然后将此文件作为有效负载传递。在您的例子中,它是XML,例如接口。
https://sqa.stackexchange.com/questions/35896
复制相似问题