Selcukes Databind
Selcukes DataBind helps to parse Json and Yml files
Setup
Selcukes Databind is primarily used as a Java dependency . We typically use a build tool (such as Maven or Gradle) to resolve the Selcukes Databind dependency.
- Maven
- Gradle
<dependency>
<groupId>io.github.selcukes</groupId>
<artifactId>selcukes-databind</artifactId>
<version>${selcukes.version}</version>
</dependency>
dependencies{
implementation("io.github.selcukes:selcukes-databind:${selcukes.version}")
}
note
Selcukes DataBind is a transitive Dependency of webdriver-binaries
.If you are using webdriver-binaries
, then ignore adding this dependency explicitly.
Data Mapper
DataMapper object helps to read and write Json or yaml/yml files with @DataFile
annotation.
Resolution Algorithm
DataMapper looks for matching data files in test resource folder by converting POJO class name to a SnakeCase json or yaml/yml file.
- For POJO class
TestUsers.java
- Matching test data files are
test_users.json
ortest_users.yml
ortest_users.yaml
@DataFile
annotation also takes additional attributes as follows
- fileName : Specify custom data file like 'mydata.json'
- filePath : path where data file is located. 'src/main/resources'
- rootFolder : root directory