Skip to content

Commit ba56908

Browse files
committed
Data driven framework
Data driven framework intial login test
1 parent e45125b commit ba56908

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+2090
-0
lines changed

.classpath

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" output="target/classes" path="src/main/java">
4+
<attributes>
5+
<attribute name="optional" value="true"/>
6+
<attribute name="maven.pomderived" value="true"/>
7+
</attributes>
8+
</classpathentry>
9+
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
10+
<attributes>
11+
<attribute name="maven.pomderived" value="true"/>
12+
</attributes>
13+
</classpathentry>
14+
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
15+
<attributes>
16+
<attribute name="optional" value="true"/>
17+
<attribute name="maven.pomderived" value="true"/>
18+
<attribute name="test" value="true"/>
19+
</attributes>
20+
</classpathentry>
21+
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
22+
<attributes>
23+
<attribute name="maven.pomderived" value="true"/>
24+
<attribute name="test" value="true"/>
25+
</attributes>
26+
</classpathentry>
27+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
28+
<attributes>
29+
<attribute name="maven.pomderived" value="true"/>
30+
</attributes>
31+
</classpathentry>
32+
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
33+
<attributes>
34+
<attribute name="maven.pomderived" value="true"/>
35+
</attributes>
36+
</classpathentry>
37+
<classpathentry kind="output" path="target/classes"/>
38+
</classpath>

.project

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>DataDrivenFramework</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.m2e.core.maven2Builder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
</buildSpec>
19+
<natures>
20+
<nature>org.eclipse.jdt.core.javanature</nature>
21+
<nature>org.eclipse.m2e.core.maven2Nature</nature>
22+
</natures>
23+
</projectDescription>

.settings/org.eclipse.jdt.core.prefs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
3+
org.eclipse.jdt.core.compiler.compliance=1.5
4+
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
5+
org.eclipse.jdt.core.compiler.release=disabled
6+
org.eclipse.jdt.core.compiler.source=1.5

.settings/org.eclipse.m2e.core.prefs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
activeProfiles=
2+
eclipse.preferences.version=1
3+
resolveWorkspaceProjects=true
4+
version=1

pom.xml

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
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+
<groupId>com.w2a</groupId>
5+
<artifactId>DataDrivenFramework</artifactId>
6+
<version>0.0.1-SNAPSHOT</version>
7+
<dependencies>
8+
9+
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
10+
<dependency>
11+
<groupId>org.testng</groupId>
12+
<artifactId>testng</artifactId>
13+
<version>6.11</version>
14+
</dependency>
15+
16+
17+
18+
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
19+
<dependency>
20+
<groupId>org.seleniumhq.selenium</groupId>
21+
<artifactId>selenium-java</artifactId>
22+
<version>2.53.1</version>
23+
</dependency>
24+
25+
26+
<!-- https://mvnrepository.com/artifact/com.relevantcodes/extentreports -->
27+
<dependency>
28+
<groupId>com.relevantcodes</groupId>
29+
<artifactId>extentreports</artifactId>
30+
<version>2.41.2</version>
31+
</dependency>
32+
33+
<!-- https://mvnrepository.com/artifact/org.uncommons/reportng -->
34+
<dependency>
35+
<groupId>org.uncommons</groupId>
36+
<artifactId>reportng</artifactId>
37+
<version>1.1.4</version>
38+
</dependency>
39+
40+
<!-- https://mvnrepository.com/artifact/com.google.inject/guice -->
41+
<dependency>
42+
<groupId>com.google.inject</groupId>
43+
<artifactId>guice</artifactId>
44+
<version>4.1.0</version>
45+
</dependency>
46+
47+
48+
<!-- https://mvnrepository.com/artifact/log4j/log4j -->
49+
<dependency>
50+
<groupId>log4j</groupId>
51+
<artifactId>log4j</artifactId>
52+
<version>1.2.17</version>
53+
</dependency>
54+
55+
<!-- https://mvnrepository.com/artifact/javax.mail/mail -->
56+
<dependency>
57+
<groupId>javax.mail</groupId>
58+
<artifactId>mail</artifactId>
59+
<version>1.4.7</version>
60+
</dependency>
61+
62+
63+
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
64+
<dependency>
65+
<groupId>mysql</groupId>
66+
<artifactId>mysql-connector-java</artifactId>
67+
<version>6.0.5</version>
68+
</dependency>
69+
70+
71+
<!-- Dependency for POI API -->
72+
<!-- http://mvnrepository.com/artifact/org.apache.poi/poi -->
73+
<dependency>
74+
<groupId>org.apache.poi</groupId>
75+
<artifactId>poi</artifactId>
76+
<version>3.6</version>
77+
</dependency>
78+
79+
<!-- http://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
80+
<dependency>
81+
<groupId>org.apache.poi</groupId>
82+
<artifactId>poi-ooxml</artifactId>
83+
<version>3.6</version>
84+
</dependency>
85+
<!-- http://mvnrepository.com/artifact/dom4j/dom4j -->
86+
<dependency>
87+
<groupId>dom4j</groupId>
88+
<artifactId>dom4j</artifactId>
89+
<version>1.1</version>
90+
</dependency>
91+
92+
<!-- http://mvnrepository.com/artifact/org.apache.xmlbeans/xmlbeans -->
93+
<dependency>
94+
<groupId>org.apache.xmlbeans</groupId>
95+
<artifactId>xmlbeans</artifactId>
96+
<version>2.3.0</version>
97+
</dependency>
98+
99+
<!-- http://mvnrepository.com/artifact/org.apache.poi/poi-ooxml-schemas -->
100+
<dependency>
101+
<groupId>org.apache.poi</groupId>
102+
<artifactId>poi-ooxml-schemas</artifactId>
103+
<version>3.6</version>
104+
</dependency>
105+
106+
107+
108+
109+
110+
</dependencies>
111+
112+
113+
114+
<build>
115+
<plugins>
116+
117+
<plugin>
118+
<groupId>org.apache.maven.plugins</groupId>
119+
<artifactId>maven-surefire-plugin</artifactId>
120+
<version>2.18.1</version>
121+
<configuration>
122+
<testFailureIgnore> false </testFailureIgnore>
123+
<suiteXmlFiles>
124+
<suiteXmlFile>src/test/resources/runner/testng.xml</suiteXmlFile>
125+
126+
</suiteXmlFiles>
127+
</configuration>
128+
129+
130+
131+
132+
133+
</plugin>
134+
135+
136+
</plugins>
137+
138+
139+
<testResources>
140+
<testResource>
141+
<directory>src/test/resources/properties</directory>
142+
<includes>
143+
<include>log4j.properties</include>
144+
</includes>
145+
</testResource>
146+
</testResources>
147+
148+
149+
</build>
150+
151+
152+
153+
154+
</project>

src/.project

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>src</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
</buildSpec>
9+
<natures>
10+
</natures>
11+
</projectDescription>
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
package com.w2a.base;
2+
3+
import java.io.FileInputStream;
4+
import java.io.FileNotFoundException;
5+
import java.io.IOException;
6+
import java.util.Properties;
7+
import java.util.concurrent.TimeUnit;
8+
9+
import org.openqa.selenium.WebDriver;
10+
import org.openqa.selenium.chrome.ChromeDriver;
11+
import org.openqa.selenium.firefox.FirefoxDriver;
12+
import org.openqa.selenium.ie.InternetExplorerDriver;
13+
import org.testng.annotations.AfterSuite;
14+
import org.testng.annotations.BeforeSuite;
15+
16+
public class TestBase {
17+
18+
/*Webdriver
19+
porperties
20+
logs
21+
Db
22+
excel
23+
mail
24+
extentreports
25+
*/
26+
27+
public static WebDriver driver;
28+
public static Properties config = new Properties();
29+
public static Properties OR = new Properties();
30+
public static FileInputStream fis;
31+
32+
@BeforeSuite
33+
public void setUp()
34+
{
35+
if(driver==null)
36+
{
37+
38+
try {
39+
fis = new FileInputStream(System.getProperty("user.dir")+"\\src\\test\\resources\\properties\\config.properties");
40+
} catch (FileNotFoundException e) {
41+
// TODO Auto-generated catch block
42+
e.printStackTrace();
43+
}
44+
try {
45+
config.load(fis);
46+
} catch (IOException e1) {
47+
// TODO Auto-generated catch block
48+
e1.printStackTrace();
49+
}
50+
51+
try {
52+
fis = new FileInputStream(System.getProperty("user.dir")+"\\src\\test\\resources\\properties\\OR.properties");
53+
} catch (FileNotFoundException e) {
54+
// TODO Auto-generated catch block
55+
e.printStackTrace();
56+
}
57+
try {
58+
OR.load(fis);
59+
} catch (IOException e) {
60+
// TODO Auto-generated catch block
61+
e.printStackTrace();
62+
}
63+
64+
if(config.getProperty("browser").equals("firefox")) {
65+
driver = new FirefoxDriver();
66+
}
67+
else if(config.getProperty("browser").equals("chrome"))
68+
{
69+
System.setProperty("webdriver.chrome.driver", System.getProperty("user.dir")+"\\src\\test\\resources\\executables\\chromedriver.exe");
70+
driver = new ChromeDriver();
71+
}
72+
else if(config.getProperty("browser").equals("ie"))
73+
{
74+
System.setProperty("webdriver.ie.driver", System.getProperty("user.dir")+"\\src\\test\\resources\\executables\\iedriver.exe");
75+
driver = new InternetExplorerDriver();
76+
}
77+
78+
driver.get(config.getProperty("testsiteurl"));
79+
driver.manage().window().maximize();
80+
driver.manage().timeouts().implicitlyWait(Integer.parseInt(config.getProperty("implicit.wait")), TimeUnit.SECONDS);
81+
}
82+
83+
84+
85+
}
86+
87+
@AfterSuite
88+
public void tearDown()
89+
{
90+
if(driver!=null) {
91+
driver.quit();
92+
}
93+
}
94+
95+
96+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.w2a.rough;
2+
3+
import java.io.FileInputStream;
4+
import java.io.FileNotFoundException;
5+
import java.io.IOException;
6+
import java.util.Properties;
7+
8+
public class TestProperties {
9+
10+
public static void main(String[] args) throws IOException {
11+
System.out.println(System.getProperty("user.dir"));
12+
Properties config = new Properties();
13+
Properties OR = new Properties();
14+
FileInputStream fis = new FileInputStream(System.getProperty("user.dir")+"\\src\\test\\resources\\properties\\config.properties");
15+
config.load(fis);
16+
17+
fis = new FileInputStream(System.getProperty("user.dir")+"\\src\\test\\resources\\properties\\OR.properties");
18+
OR.load(fis);
19+
System.out.println(config.getProperty("browser"));
20+
21+
System.out.println(OR.getProperty("bmlBtn"));
22+
}
23+
24+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.w2a.testcases;
2+
3+
import org.openqa.selenium.By;
4+
import org.testng.annotations.Test;
5+
6+
import com.w2a.base.TestBase;
7+
8+
public class LoginTest extends TestBase{
9+
10+
11+
@Test
12+
public void loginAsbankManager() throws InterruptedException
13+
{
14+
driver.findElement(By.cssSelector(OR.getProperty("bmlBtn"))).click();
15+
Thread.sleep(3000);
16+
}
17+
18+
}
7.5 KB
Binary file not shown.
Binary file not shown.
7.41 MB
Binary file not shown.
5.42 MB
Binary file not shown.

src/test/resources/logs/Application.log

Whitespace-only changes.

src/test/resources/logs/Selenium.log

Whitespace-only changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
browser=chrome
2+
testsiteurl=http://www.way2automation.com/angularjs-protractor/banking/#/login
3+
implicit.wait=10
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
bmlBtn=body > div.ng-scope > div > div.ng-scope > div > div.borderM.box.padT20 > div:nth-child(3) > button
2+

0 commit comments

Comments
 (0)