My framework.

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

My framework.

Illusion0Reality
As I said, my test data will be in XLS file. And this has


2nd column page name
3rd column  filedname -
4th column  filedvalues
5th column  navigation

6th column validations (list value verification, enabled etc)
Not yet implemented, I will, soon.

All the above data will be put in a page-wise manner.

Login
   un = John
   pw = mypassword
   submit

Details.
   ph = 1234
   addr = mypassword
   save

This data will be fetched  from the xls and being put into an array (using Apache POI)
And, I loop until the array's length. If any failure (object not found etc), I will exit and write the result into XLS.

Every pass and fail should be written into XLS. Very detailed....

Please let me know, if any further improvements can be made.



import jxl.*;
import java.io.*;
import java.util.*;
import java.util.Properties;
import com.thoughtworks.selenium.*;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriverBackedSelenium;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.By;
import org.openqa.selenium.Alert;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;

import static org.junit.Assert.*;
import org.junit.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;


import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFDataFormat;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.util.HSSFColor;
import org.openqa.selenium.server.RemoteControlConfiguration;
import org.openqa.selenium.server.SeleniumServer;

public class Test2Class extends AllVariables
{
public void CreateDriverAndSetup()
throws Exception
{
driver = new FirefoxDriver();
//driver = new InternetExplorerDriver();
selenium = new WebDriverBackedSelenium(driver, "");
driver.get("http://myURL");
selenium.getEval("top.window.moveTo(0, 0)");
selenium.getEval("top.window.resizeTo(screen.availWidth, screen.availHeight)");
Thread.sleep(300000);
//Runtime.getRuntime().exec("c:\\cp.exe");
}

@Test
public void allPages()
throws Exception
{
GenericFunctions av= new GenericFunctions();
av.readexcelForPagewithPOI("C:\\myfile.xls");
pnamearr=pnames.split(";");

for (av.pagerows =0; av.pagerows<=pnamearr.length-1 ;av.pagerows++)
{
String pval =pnamearr[av.pagerows];
if ( pval.contains(TestEndflag) | av.exitTest==true )
{ av.exitTest=false;
//driver.close();
break;
}

pval=pnamearr[pagerows];
AllKeywords keyword = AllKeywords.valueOf(pval);
switch (keyword)
{
case login:
Login logob= new Login();
logob.LoginPage(keyword.toString());
break;

case Accounts:
System.out.println("Accounts");
break;

case Newpage:
System.out.println("New page");
break;
}}}}
---------
Reply | Threaded
Open this post in threaded view
|

Re: My framework.

softwaretestingforum
Administrator
By and large the idea looks good to me.
Though I need to see entire code to understand it well.

On the contrary I personally prefer text, csv file over excel, as excel is binary and version control is not going to help here.
But as I said it is my personal choice.

I also see that you mention about writing test results back in excel file. This is interesting, and I suppose this is also one of the compelling reason for you to use excel.
~ seleniumtests.com
Reply | Threaded
Open this post in threaded view
|

Re: My framework.

Illusion0Reality
"excel is binary" - can be please elaborate.
How do you control the version changes .
Reply | Threaded
Open this post in threaded view
|

Re: My framework.

softwaretestingforum
Administrator
let me copy the definition of binary file from wikipedia -

"A binary file is a computer file which may contain any type of data, encoded in binary form for computer storage and processing purposes; for example, computer document files containing formatted text. Many binary file formats contain parts that can be interpreted as text; binary files that contain only textual data—without, for example, any formatting information—are called plain text files. In many cases, plain text files are considered to be different from binary files because binary files are made up of more than just plain text. When downloading, a completely functional program without any installer is also often called program binary, or binaries (as opposed to the source code)."

See it this way, if you make changes in excel it would be difficult for you to compare two different version at any point of time using version control system. Same goes with jar file and it is horrible practice to keep jar file in version control system.

On the other hand version control systems are best suited for text files.
~ seleniumtests.com