Configure Complex Object or Collection in EasyTest

I experimented and the conclusion is:

1. EasyTest's JSON support feature can handle the complex nested object or collection object.

2. In test method, you can write collection with generics, very cool! very handy!

@Test
public void testBuildCustomerOrderWithFollow(@Param(name = "PlaceOrderRequest") PlaceOrderRequest placOrderRequest,
			@Param(name = "ArrayList<CustomerOrder>") ArrayList<CustomerOrder> customerOrder) {}

3. In Excel

Configure Complex Object or Collection in EasyTest_第1张图片

The PlaceOrderRequest is a nested object, and ArrayList<CustomerOrder> is collection with generics

Note that in test method you will get a ArrayList<LinkedHashMap> instead, rather than ArrayList<CustomerOrder>, I have not found an elegant method to cope with this, but write a utility method to convert ArrayList<LinkedHashMap> to ArrayList<CustomerOrder>.


4. Tip

In excel with JSON fixture, we can add a Remark column for each case, and this Remark field's value can be set as plain text, you don't have to set it as a JSON string. With this Remark field's help, the test fixture becomes much easier to read and maintain.

Configure Complex Object or Collection in EasyTest_第2张图片

你可能感兴趣的:(Configure Complex Object or Collection in EasyTest)