com.github.superproxy:test-data-provider

Test Data Provider

License

License

Categories

Categories

IDE Development Tools Data
GroupId

GroupId

com.github.superproxy
ArtifactId

ArtifactId

test-data-provider
Last Version

Last Version

0.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

com.github.superproxy:test-data-provider
Test Data Provider
Project URL

Project URL

https://github.com/superproxy/test-data-provider
Source Code Management

Source Code Management

https://github.com/superproxy/test-data-provider

Download test-data-provider

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.superproxy/test-data-provider/ -->
<dependency>
    <groupId>com.github.superproxy</groupId>
    <artifactId>test-data-provider</artifactId>
    <version>0.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.superproxy/test-data-provider/
implementation 'com.github.superproxy:test-data-provider:0.1.0'
// https://jarcasting.com/artifacts/com.github.superproxy/test-data-provider/
implementation ("com.github.superproxy:test-data-provider:0.1.0")
'com.github.superproxy:test-data-provider:jar:0.1.0'
<dependency org="com.github.superproxy" name="test-data-provider" rev="0.1.0">
  <artifact name="test-data-provider" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.superproxy', module='test-data-provider', version='0.1.0')
)
libraryDependencies += "com.github.superproxy" % "test-data-provider" % "0.1.0"
[com.github.superproxy/test-data-provider "0.1.0"]

Dependencies

compile (9)

Group / Artifact Type Version
org.testng : testng jar 6.1.1
javassist : javassist jar 3.12.1.GA
org.apache.commons : commons-lang3 jar 3.4
org.slf4j : slf4j-api jar 1.6.2
org.slf4j : jcl-over-slf4j jar 1.6.2
ch.qos.logback : logback-core jar 0.9.29
ch.qos.logback : logback-classic jar 0.9.29
org.springframework : spring-context jar 3.2.4.RELEASE
com.alibaba : fastjson jar 1.2.5

test (2)

Group / Artifact Type Version
org.mockito : mockito-all jar 1.10.19
org.springframework : spring-test jar 3.2.4.RELEASE

Project Modules

There are no modules declared in this project.

Test-Data-Provider

Extends the feture of data provider supported by Testng.

Feture

  • Support csv file format
  • Support json file format

Usage

#####1. Add the dependency

<dependency>     
    <groupId>com.github.superproxy</groupId>    
    <artifactId>test-data-provider</artifactId>    
    <version>0.1.0</version>    
</dependency>    

####2. Design a use case and input the following test data into a csv file or a json file.

age,expected
9,0 
10,1 
20,2  
30,3
100,3

####3. Add the @Csv annotion on a test and set dataProviderClass=CommonDataProvider.class and set dataProvider= genData

  @Test(dataProvider = "genData", dataProviderClass = CommonDataProvider.class) 
  @Csv("/service/UserService/testCalRank.csv")  
  public void testCalRank(String age, int expected) throws Exception { 
      User user = new User();  
      user.setAge(Integer.parseInt(age));  
      assertEquals(userService.calRank(user), expected);  
  }  

Versions

Version
0.1.0