com.sunnydsouza.testframework.layers.execution.Framework Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of testframework Show documentation
Show all versions of testframework Show documentation
Generic frameowrk with different standalone layers for reporting,logging,test execution and test data management.
package com.sunnydsouza.testframework.layers.execution;
import org.openqa.selenium.WebDriver;
import bsh.EvalError;
public class Framework extends AbstractFramework {
//public ObjectRepositoryReader objectRepository;
//public TestDataReader testDataReader;
//private WebDriver driver;
public Framework(){
super();
}
public Framework(WebDriver driver) {
this.driver=driver;
}
public String testA(String str){
return str;
}
/*public WebDriver getDriver(){
return this.driver;
}*/
/*public void runKeyword2(WebDriver driver,By b){
System.out.println("Yes,executed");
}
public static void OpenURL(WebDriver driver,String URL){
driver.get(URL);
}
public void prerequisteHANDLER_setOR(String param1,String param2,String param3,String param4){
prerequisteHANDLER_setOR(param1,param2,param3,param4,null);
}
public void prerequisteHANDLER_setOR(String param1,String param2,String param3,String param4,String param5){
String name=param1;
String type=param2;
switch (type.toLowerCase()){
case "excel":String pathToSheet=param3;
String sheetName=param4;
String pageObject=param5;
if(pageObject==null){
System.out.println(prerequisteHANDLER_ObjectRepository_Excel(pathToSheet,sheetName));
}
else {
System.out.println(prerequisteHANDLER_ObjectRepository_Excel(pathToSheet,sheetName,pageObject));
}
break;
}
}
public void prerequisteHANDLER_setTestData(String param1,String param2,String param3,String param4){
prerequisteHANDLER_setTestData(param1,param2,param3,param4,null);
}
public void prerequisteHANDLER_setTestData(String param1,String param2,String param3,String param4,String param5){
String name=param1;
String type=param2;
switch (type.toLowerCase()){
case "excel":String pathToSheet=param3;
String sheetName=param4;
String testCase=param5;
System.out.println(prerequisteHANDLER_TestData_Excel(pathToSheet,sheetName,testCase));
break;
}
}
public Map prerequisteHANDLER_TestData_Excel(String pathToSheet, String sheetName,String testCase){
TestDataReader d=new TestDataReader(testCase,sheetName,new Excel.Driver(pathToSheet));
return d.data;
}
public Map prerequisteHANDLER_ObjectRepository_Excel(String pathToSheet, String sheetName){
ObjectRepositoryReader OR=new ObjectRepositoryReader();
PageObject pageObjects=OR.readOR(sheetName,new Excel.Driver(pathToSheet));
return pageObjects.Item;
}
public Map prerequisteHANDLER_ObjectRepository_Excel(String pathToSheet, String sheetName,String pageObject){
ObjectRepositoryReader OR=new ObjectRepositoryReader();
PageObject pageObjects=OR.readOR(sheetName,new Excel.Driver(pathToSheet));
return pageObjects.Item;
}
public static String decodeStr(String encodeStr) {
byte[] decoded = Base64.decodeBase64(encodeStr);
return new String (decoded);
}*/
public static void main(String[] args) throws EvalError{
/*String frameworkPath=System.getProperty("user.dir")+"\\src\\main\\java\\com\\sunnydsouza\\testframework\\";*/
/*
String TDfilepath=frameworkPath+"resources\\InvestmentTrackerTestData.xlsx";
String ORfilepath=frameworkPath+"resources\\InvestmentTrackerRepo.xlsx";
ObjectRepositoryReader OR=new ObjectRepositoryReader();
TestData d=new TestDataReader("HDFC","InvestmentTracker",new Excel.Driver(TDfilepath));
System.out.println(d.data);
PageObject hdfc=OR.readOR("HDFC",new Excel.Driver(ORfilepath));
System.out.println(hdfc.Item);
SeleniumWebdriver WD=new SeleniumWebdriver();
*/
/*System.setProperty("webdriver.chrome.driver",frameworkPath+"libraries\\chromedriver.exe");
WebDriver driver=new ChromeDriver();
Interpreter i=new Interpreter();
i.set("driver", driver);
//OpenURL((WebDriver)i.get("driver"),"https://google.com");
//Interpreter i = new Interpreter();
// System.out.println(i.getNameSpace().toString());
try {
//i.eval("ChromeDriver param1=null;");
i.eval("import *;");
i.eval("WebDriver param1=driver");
//i.eval("By param2=By.xpath(\"//select[@name='login_type']\");");
} catch (EvalError e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
OpenURL((WebDriver)i.get("param1"),"https://yahoo.com"); */
/*IsKeywordDriven k=new IsKeywordDriven();
//k.runKeyword(f);
String KDfilepath=frameworkPath+"resources\\KeywordDrivenConcept.xlsx";
k.runKeywordFile(f,"TC1", "KeywordDriven", new Excel.Driver(KDfilepath));
IsKeywordDriven.KEYWORD_MAP.put("1", "dfsdf");
System.out.println(IsKeywordDriven.KEYWORD_MAP.keySet());*/
//f.writeText(driver, wb, text);
}
/*@Override
public void setConfigurationFile() {
// TODO Auto-generated method stub
FrameworkConfigurator.;
}
@Override
public Framework setWebDriver(WebDriver driver) {
this.driver=driver;
return this;
}
@Override
public void loadConfiguration() {
FrameworkConfigurator.
}*/
}