How to test all the test cases of a login functionality and print the output in excel sheet

hi all,

I wanted to test all the test cases of my login functionality and print the out put in the excel sheet. I am reading the input username and password from the excel sheet and print the output in another excel sheet.

Username Password Result

adadf 123456 Fail
sankar 123456 Pass
Ravi Fail

I wanted to print the above format in excel sheet. I want to test all the test cases of the Login functionality.

Below is my code

package login;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.net.URL;
import java.util.concurrent.TimeUnit;

import org.junit.After;
import org.junit.Before;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.support.ui.Select;
import org.testng.annotations.Test;

import io.appium.java_client.MobileBy;
import io.appium.java_client.android.AndroidDriver;
import jxl.Sheet;
import jxl.Workbook;
import jxl.write.Label;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;

import org.testng.annotations.BeforeTest;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeClass;

public class sample {
public WebDriver driver;
public String str;
String Text = “Login • TATX sharjeelbaig®gmail.com 'Password 0 Please enter Password minimum 6-digits FORGOT PASSWORD? LOGIN WITH f raceboo $8 goosIs “(ksername OR E (Password L TATX Please enter Emailld Cmh FORGOT PASSWORD? LOGIN WITH f faceboo $8 000010”;
@Test
public void f() throws Exception{

driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

  Thread.sleep(3000);

FileInputStream fi=new FileInputStream(“D:\Sankar\workspace\Tatx.xls”);
Workbook w=Workbook.getWorkbook(fi);
Sheet s=w.getSheet(“Signin”);
FileOutputStream fo=new FileOutputStream(“D:\Sankar\workspace\Tatx_Results.xls”);
WritableWorkbook wb=Workbook.createWorkbook(fo);
WritableSheet ws=wb.createSheet(“tatx1”, 0);

String[] sh=w.getSheetNames();
System.out.println("No of sheets :"+sh.length);

for (int i = 1; i < s.getRows(); i++) {
try{
System.out.println(“P”);
driver.findElement(By.name(“SIGN IN”)).click();

/*driver.findElement(By.name("Username OR Email")).clear();

driver.findElement(By.id("com.tatx.userapp:id/et_email")).sendKeys(s.getCell(0, i).getContents());

driver.findElement(By.id("com.tatx.userapp:id/et_password")).clear();

driver.findElement(By.id("com.tatx.userapp:id/et_password")).sendKeys(s.getCell(1, i).getContents());

driver.findElement(By.name("SIGN IN")).click();*/

Thread.sleep(3000);
String st = driver.findElement(MobileBy.name(“Order”)).getText();
System.out.println(st);
Assert.assertEquals(“Order”, st);
if (“Order”==st) {

	str="Pass";	
}
else {
	str="Fail";
}*/
str="Passed";
}
catch (Exception e) {str="Failed";
}

Label result=new Label(3, i, str);
ws.addCell(result);

for(int j=0; j<s.getColumns(); j++)
{
System.out.println(s.getCell(j, i).getContents());
Label un=new Label(j, i, s.getCell(j, i).getContents());
ws.addCell(un);
}
}
Label or=new Label(0,0,“Username”);
Label dn=new Label(1,0,“Password”);
Label ot=new Label(2,0,“Manual Result”);
Label td=new Label(3,0,“Automation Result”);

ws.addCell(or);
ws.addCell(dn);
ws.addCell(ot);
ws.addCell(td);

wb.write();
wb.close();
}

@After
public void afterTest() {
driver.close();
driver.quit();
driver = null;
}

@BeforeClass
public void beforeTest() throws Exception {
DesiredCapabilities dc=new DesiredCapabilities();
//dc.setCapability(“deviceName”, “Moto X”);
dc.setCapability(“deviceName”, “Galaxy Grand Prime”);
dc.setCapability(“platformVersion”, “5.1”);
dc.setCapability(“platformName”, “Android”);
dc.setCapability(“appPackage”, “com.tatx.userapp”);
dc.setCapability(“appActivity”, “com.tatx.userapp.activities.SplashScreen”);
//driver=new RemoteWebDriver(new URL(“http://127.0.0.1:4723/wd/hub”),dc);
driver = new AndroidDriver(new URL(“http://127.0.0.1:4723/wd/hub”), dc);
}
}