Skip to content

Commit 9e6f4a4

Browse files
committed
initial commit
0 parents  commit 9e6f4a4

File tree

15 files changed

+567
-0
lines changed

15 files changed

+567
-0
lines changed

.gitignore

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
target/
2+
!.mvn/wrapper/maven-wrapper.jar
3+
!**/src/main/**/target/
4+
!**/src/test/**/target/
5+
6+
### IntelliJ IDEA ###
7+
.idea/modules.xml
8+
.idea/jarRepositories.xml
9+
.idea/compiler.xml
10+
.idea/libraries/
11+
*.iws
12+
*.iml
13+
*.ipr
14+
15+
### Eclipse ###
16+
.apt_generated
17+
.classpath
18+
.factorypath
19+
.project
20+
.settings
21+
.springBeans
22+
.sts4-cache
23+
24+
### NetBeans ###
25+
/nbproject/private/
26+
/nbbuild/
27+
/dist/
28+
/nbdist/
29+
/.nb-gradle/
30+
build/
31+
!**/src/main/**/build/
32+
!**/src/test/**/build/
33+
34+
### VS Code ###
35+
.vscode/
36+
37+
### Mac OS ###
38+
.DS_Store

.idea/.gitignore

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/encodings.xml

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/inspectionProfiles/Project_Default.xml

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/uiDesigner.xml

Lines changed: 124 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pom.xml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<groupId>io.github.mfaisalkhatri</groupId>
6+
<artifactId>selenium-json-data-driven</artifactId>
7+
<version>1.0-SNAPSHOT</version>
8+
<packaging>jar</packaging>
9+
10+
<name>selenium-json-data-driven</name>
11+
<url>http://maven.apache.org</url>
12+
13+
<properties>
14+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15+
<selenium.version>4.31.0</selenium.version>
16+
<testng.version>7.11.0</testng.version>
17+
<gson.version>2.12.1</gson.version>
18+
<lombok.version>1.18.38</lombok.version>
19+
<java.release.version>17</java.release.version>
20+
<maven.compiler.version>3.13.0</maven.compiler.version>
21+
<surefire-version>3.5.0</surefire-version>
22+
<maven.source.encoding>UTF-8</maven.source.encoding>
23+
</properties>
24+
<dependencies>
25+
<dependency>
26+
<groupId>org.seleniumhq.selenium</groupId>
27+
<artifactId>selenium-java</artifactId>
28+
<version>${selenium.version}</version>
29+
</dependency>
30+
<dependency>
31+
<groupId>org.testng</groupId>
32+
<artifactId>testng</artifactId>
33+
<version>${testng.version}</version>
34+
<scope>test</scope>
35+
</dependency>
36+
<dependency>
37+
<groupId>com.google.code.gson</groupId>
38+
<artifactId>gson</artifactId>
39+
<version>${gson.version}</version>
40+
</dependency>
41+
<dependency>
42+
<groupId>org.projectlombok</groupId>
43+
<artifactId>lombok</artifactId>
44+
<version>${lombok.version}</version>
45+
<scope>provided</scope>
46+
</dependency>
47+
</dependencies>
48+
<build>
49+
<plugins>
50+
<plugin>
51+
<groupId>org.apache.maven.plugins</groupId>
52+
<artifactId>maven-compiler-plugin</artifactId>
53+
<version>${maven.compiler.version}</version>
54+
<configuration>
55+
<release>${java.release.version}</release>
56+
<encoding>${maven.source.encoding}</encoding>
57+
<forceJavacCompilerUse>true</forceJavacCompilerUse>
58+
</configuration>
59+
</plugin>
60+
<plugin>
61+
<groupId>org.apache.maven.plugins</groupId>
62+
<artifactId>maven-surefire-plugin</artifactId>
63+
<version>${surefire-version}</version>
64+
<executions>
65+
<execution>
66+
<goals>
67+
<goal>test</goal>
68+
</goals>
69+
</execution>
70+
</executions>
71+
<configuration>
72+
<useSystemClassLoader>false</useSystemClassLoader>
73+
<properties>
74+
<property>
75+
<name>usedefaultlisteners</name>
76+
<value>false</value>
77+
</property>
78+
</properties>
79+
</configuration>
80+
</plugin>
81+
</plugins>
82+
</build>
83+
</project>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package io.github.mfaisalkhatri.data;
2+
3+
import lombok.Getter;
4+
import lombok.ToString;
5+
6+
@Getter
7+
@ToString
8+
public class RegistrationData {
9+
10+
private String firstName;
11+
private String lastName;
12+
private String dob;
13+
private String street;
14+
private String postalCode;
15+
private String city;
16+
private String state;
17+
private String country;
18+
private String phone;
19+
private String emailAddress;
20+
private String password;
21+
private boolean isValid;
22+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package io.github.mfaisalkhatri.data;
2+
3+
import java.io.FileReader;
4+
import java.io.IOException;
5+
import java.io.Reader;
6+
import java.nio.file.Paths;
7+
import java.util.List;
8+
9+
import com.google.gson.Gson;
10+
11+
public class RegistrationDataBuilder {
12+
13+
public List<RegistrationData> registrationData (final boolean isValid) {
14+
final Gson gson = new Gson ();
15+
final TestData testData;
16+
try (
17+
final Reader reader = new FileReader(
18+
Paths.get(System.getProperty("user.dir"), "src", "test", "resources", "testdata.json").toString())) {
19+
testData = gson.fromJson (reader, TestData.class);
20+
} catch (final IOException e) {
21+
throw new Error ("Error reading json file", e);
22+
}
23+
24+
return testData.getRegistrationData ()
25+
.stream ()
26+
.filter (d -> d.isValid () == isValid)
27+
.toList ();
28+
}
29+
30+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package io.github.mfaisalkhatri.data;
2+
3+
import java.util.List;
4+
5+
import lombok.Getter;
6+
7+
@Getter
8+
public class TestData {
9+
10+
private List<RegistrationData> registrationData;
11+
12+
}

0 commit comments

Comments
 (0)