How to parse DataProvider
This article introduces you how to analyze DataProvider, the content is very detailed, interested friends can refer to, hope to be helpful to you.
Entity import lombok.AllArgsConstructor;import lombok.Data;import lombok.NoArgsConstructor;import lombok.experimental.Accessors;import lombok.extern.log4j.Log4j;import java.util.Map;/** * @ author liwen406 * @ Title: MyHttpEntity * @ Description: request entity class * @ date 2019-3-24 / 17:54 * / @ Log4j@Data@NoArgsConstructor@AllArgsConstructor@Accessors (chain = true) public class MyHttpEntity {String url; String ip; String body; String info; Map parameter; Map header } data read @ Data@Log4jpublic class Dataprovidert {@ DataProvider public Object [] [] getparam () {int k = 0; String [] param = {"2367952", "2367141", "2366552", "2364334"}; Object [] [] result = new Object [param.length] []; for (int I = 0; I < param.length; iTunes +) {MyHttpEntity httpEntity = new MyHttpEntity () HttpEntity.setUrl ("https://blog.51cto.com/357712148/" + param [I]); result [knot +] = new Object [] {httpEntity};} return result;}} run the test class @ Test (dataProvider =" getparam ", dataProviderClass = Dataprovidert.class) public void mydatep (MyHttpEntity httpEntity) {HttpResponse response = HttpRequest.get (httpEntity.url). Execute () Log.info ("response" + response.body ();}
Pom.xml
Cn.hutool hutool-all 4.4.0 org.projectlombok lombok 1.18.4 provided on how to parse DataProvider to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.