Skip to content

Commit c99d370

Browse files
committed
Added Base class
1 parent 82fce1e commit c99d370

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package selenium.context;
2+
3+
import org.springframework.beans.factory.annotation.Autowired;
4+
import org.springframework.beans.factory.annotation.Qualifier;
5+
import org.springframework.beans.factory.annotation.Value;
6+
import org.springframework.boot.test.SpringApplicationConfiguration;
7+
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
8+
import org.testng.annotations.Listeners;
9+
import selenium.listeners.WebDriverListener;
10+
11+
@Listeners(WebDriverListener.class)
12+
@SpringApplicationConfiguration(Application.class)
13+
public abstract class Base extends AbstractTestNGSpringContextTests {
14+
15+
@Autowired
16+
@Qualifier("appUrl")
17+
protected String appUrl;
18+
19+
@Autowired
20+
@Qualifier("browser")
21+
protected String browser;
22+
23+
@Autowired
24+
protected FileLoaderService fileLoaderService;
25+
26+
@Value("${spring.profiles.active}")
27+
String profile;
28+
29+
public String getProfile() {
30+
31+
return profile;
32+
}
33+
34+
public String getAppUrl() {
35+
return appUrl;
36+
}
37+
38+
public String getBrowser() {
39+
return browser;
40+
}
41+
}

src/test/java/selenium/listeners/WebDriverListener.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import org.testng.IInvokedMethod;
1212
import org.testng.IInvokedMethodListener;
1313
import org.testng.ITestResult;
14+
import selenium.context.Base;
1415

1516
import java.io.File;
1617
import java.io.FileInputStream;

0 commit comments

Comments
 (0)