ASF Bugzilla – Attachment 34004 Details for
Bug 59793
"Rule M2.4 exception : this error should NEVER happen!" error message is still being triggered even with POI v3.14
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
This file contains the codes of the two class I run that triggers the Rule M2.4 exception
RuleM24_exception.txt (text/plain), 6.54 KB, created by
Lam
on 2016-07-04 10:46:58 UTC
(
hide
)
Description:
This file contains the codes of the two class I run that triggers the Rule M2.4 exception
Filename:
MIME Type:
Creator:
Lam
Created:
2016-07-04 10:46:58 UTC
Size:
6.54 KB
patch
obsolete
>LoginTest_Firefox.java >---------------------- > >import java.io.IOException; >import java.io.FileInputStream; >import java.io.FileNotFoundException; >import java.io.FileOutputStream; >import java.io.IOException; >import java.io.InputStream; >import java.util.Iterator; > >import org.apache.poi.xssf.usermodel.XSSFSheet; >import org.apache.poi.xssf.usermodel.XSSFWorkbook; >import org.apache.poi.xssf.usermodel.XSSFCell; >import org.apache.poi.xssf.usermodel.XSSFRow; >import org.apache.poi.ss.usermodel.Cell; >import org.apache.poi.ss.usermodel.CellStyle; >import org.apache.poi.ss.usermodel.DataFormat; >import org.apache.poi.ss.usermodel.Row; >import org.apache.poi.ss.usermodel.Sheet; >import org.apache.poi.ss.usermodel.Workbook; > >import org.openqa.selenium.Alert; >import org.openqa.selenium.By; >import org.openqa.selenium.WebDriver; >import org.openqa.selenium.WebElement; >import org.openqa.selenium.firefox.FirefoxDriver; >import org.openqa.selenium.support.ui.ExpectedCondition; >import org.openqa.selenium.support.ui.WebDriverWait; >//import org.openqa.selenium.chrome.*; > >public class LoginTest_Firefox { > public static void main(String[] args) throws IOException, InterruptedException{ > //WebDriver login = new FirefoxDriver(); > > > LoginCredentials.getFile(); > //The following creates first row header with titles "Test Case", "Expected Result" and "Actual Result" > > > } > public static void runTest(String string, String string1) throws InterruptedException, IOException{ > WebDriver login = new FirefoxDriver(); > FileInputStream input = new FileInputStream("c:\\Test Data\\write.xlsx"); > > XSSFWorkbook workbook = new XSSFWorkbook(input); > Sheet sheet1 = workbook.createSheet("TS1"); > Row row = sheet1.createRow(LoginCredentials.count); > Cell TC = row.createCell(0); > TC.setCellValue("Test Case No."); > Cell Expected = row.createCell(1); > Expected.setCellValue("Expected Result"); > Cell Actual = row.createCell(2); > Actual.setCellValue("Actual Result"); > workbook.write(new FileOutputStream("c:\\Test Data\\write.xlsx")); > workbook.close(); > > login.get("http://www.mol.com"); > System.out.println("Working Directory = " + > System.getProperty("user.dir")); > login.findElement(By.xpath("//*[@id='lorem']/img")).isDisplayed(); > login.findElement(By.xpath("//*[@id='popupfoot']/a/i")).click(); > login.findElement(By.linkText("Log in")).click(); > Thread.sleep(3000); > login.findElement(By.xpath("//*[@id='EmailAddress']")).sendKeys(LoginCredentials.username); > login.findElement(By.xpath("//*[@id='Password']")).sendKeys(LoginCredentials.password); > Thread.sleep(3000); > login.findElement(By.xpath("//*[@id='LoginForm']/footer[1]/table/tbody/tr/td[2]/button")).click(); > Thread.sleep(3000); > login.findElement(By.xpath("//*[@id='myModalEligibleToIncreaseWalletLimit']/div/div/div[3]/a")).click(); > String i = login.findElement(By.xpath("//*[@id='AccountSettingsForm']/fieldset/section[2]/div/label")).getText(); > System.out.println(i); > //The following populate test result > if(i.equals("Please fill in for account security enquiries and account termination request.")){ > //XSSFWorkbook workbook_Result = new XSSFWorkbook("c:\\Test Data\\write.xlsx"); > //Sheet sheet = workbook_Result.createSheet("TS1"); > Row row_Pass = sheet1.createRow(LoginCredentials.count); > Cell TC_Pass = row_Pass.createCell(0); > TC_Pass.setCellValue(LoginCredentials.tc); > Cell Expected_Pass = row_Pass.createCell(1); > Expected_Pass.setCellValue(i); > Cell Result = row_Pass.createCell(2); > Result.setCellValue("PASS"); > System.out.println("PASS"); > workbook.write(new FileOutputStream("c:\\Test Data\\write.xlsx")); > workbook.close(); > } > else{ > //XSSFWorkbook workbook = new XSSFWorkbook("c:\\Test Data\\write.xlsx"); > //Sheet sheet = workbook.createSheet("TS1"); > Row row_Fail = sheet1.createRow(LoginCredentials.count); > Cell TC_Fail = row_Fail.createCell(0); > TC_Fail.setCellValue(LoginCredentials.tc); > Cell Expected_Fail = row_Fail.createCell(1); > Expected_Fail.setCellValue(i); > Cell Result = row_Fail.createCell(2); > Result.setCellValue("Fail"); > System.out.println("Fail"); > workbook.write(new FileOutputStream("c:\\Test Data\\write.xlsx")); > workbook.close(); > } > login.close(); > > } > >} > >========================================================================================================================= > >LoginCredentials.java >--------------------- > >import java.io.FileInputStream; >import java.io.FileNotFoundException; >import java.io.IOException; >import java.io.InputStream; >import java.util.Iterator; >import org.apache.poi.xssf.usermodel.XSSFCell; >import org.apache.poi.xssf.usermodel.XSSFRow; >import org.apache.poi.xssf.usermodel.XSSFSheet; >import org.apache.poi.xssf.usermodel.XSSFWorkbook; >import org.openqa.selenium.Alert; >import org.openqa.selenium.By; >import org.openqa.selenium.WebDriver; >import org.openqa.selenium.WebElement; >import org.openqa.selenium.firefox.FirefoxDriver; >import org.openqa.selenium.support.ui.ExpectedCondition; >import org.openqa.selenium.support.ui.WebDriverWait; >import org.openqa.selenium.chrome.*; > >public class LoginCredentials{ > static String username; > static String password; > static String tc; > static int count; > > public static void getFile() throws IOException, InterruptedException{ > FileInputStream fis = new FileInputStream("c:\\Test Data\\Login.xlsx"); > System.out.println("Working Directory = " + > System.getProperty("user.dir")); > XSSFWorkbook wb = new XSSFWorkbook(fis); > XSSFSheet sheet = wb.getSheet("Login"); > //System.out.println("No. of rows : " + sheet.getLastRowNum()); > for(count = 1;count<=sheet.getLastRowNum();count++){ > XSSFRow row = sheet.getRow(count); > System.out.println("Running Item no. " + row.getCell(0).toString()); > tc = row.getCell(0).toString(); > username = row.getCell(1).toString(); > password = row.getCell(2).toString(); > LoginTest_Firefox.runTest(row.getCell(1).toString(),row.getCell(2).toString()); > } > } > >} >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 59793
: 34004