You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public TestDatadriven() throws ClassNotFoundException {
super(TARGET_PACKAGE_ID,
(Class<CashTransferActivity_>) launcherActivityClass);
}
private Solo solo;
protected void setUp() throws Exception {
solo = new Solo(getInstrumentation(), getActivity());
}
public void CanOpenSettings() {
solo.pressMenuItem(0);
}
public void testblackbox() {
getTestDataFile();
TestResults = new String[rowCount];
System.out.println("solo : " + solo);
for (int i = 1; i \< rowCount; i++) {
//Enter value in First editfield
solo.enterText(0, FirstValue[i].toString());
//Enter value in Second editfield
solo.enterText(1, SecondValue[i].toString());
//Enter value in Third editfield
solo.enterText(2, ThirdValue[i].toString());
//Enter value in Fourth editfield
solo.enterText(3, FourthValue[i].toString());
//Enter value in Fifth editfield
solo.enterText(4, FifthValue[i].toString());
//Enter value in Sixth editfield
solo.enterText(5, SixthValue[i].toString());
solo.clickOnText("Cash Transfer");
solo.clickOnText("OK");
TestResults[i] = "Pass";
//String First = String.valueOf(FirstValue[i].toString());
//String Second = String.valueOf(SecondValue[i].toString());
//String Third = String.valueOf(ThirdValue[i].toString());
//String Fourth = String.valueOf(FourthValue[i].toString());
//String Fifth = String.valueOf(FifthValue[i].toString());
//String Sixth = String.valueOf(SixthValue[i].toString());
}
writeResults(TestResults);
}
public void readTestData(InputStream fileInputStream) throws
Exception {
ws = null;
workbook = null;
s = null;
int columnCount = '0';
int totalSheet = 0;
String firstSheet = "TestCases";
String secondSheet = "TestScenarios";
try {
ws = new WorkbookSettings();
ws.setLocale(new Locale("en", "EN"));
workbook = Workbook.getWorkbook(fileInputStream, ws);
totalSheet = workbook.getNumberOfSheets();
if (totalSheet > 0) {
if (!workbook.getSheet(0).getName().equals(firstSheet))
{
System.out.println("contents are not fine");
}
if (!workbook.getSheet(1).getName().equals(secondSheet))
{
System.out.println ("contents are not fine");
}
}
else {
System.out.println("There is not any sheet available.");
}
s = workbook.getSheet(0);
rowCount = s.getRows();
FirstValue = new String[rowCount]; // First Value array size
SecondValue = new String[rowCount];// Second Value array size
ThirdValue = new String[rowCount]; // Third Value array size
FourthValue = new String[rowCount];// Fourth Value array size
FifthValue = new String[rowCount]; // Fifth Value array size
SixthValue = new String[rowCount];// Sixth Value array size
columnCount = s.getColumns();
rowData = s.getRow(0);
if (rowData[0].getContents().length() != 0) {
for (int i = 1; i \< rowCount; i++) {
rowData = s.getRow(i);
if (rowData[8].getContents().equals("Yes")) {
System.out.println("Executed: "
+ rowData[1].getContents());
FirstValue[i] = rowData[2].getContents().toString();
SecondValue[i] = rowData[3].getContents().toString();
ThirdValue[i] = rowData[4].getContents().toString();
...
From duynguye...@gmail.com on October 05, 2011 01:08:46
Hi all!
I'm trying test datadriven on Robotium, but when i build, it have some
error and i can't fix them:
This is my code:
package com.hlt.stocktrade.test;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Locale;
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.WorkbookSettings;
import jxl.read.biff.BiffException;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import com.hlt.stocktrade.myaccount.*;
import com.jayway.android.robotium.solo.Solo;
import android.content.Context;
import android.test.ActivityInstrumentationTestCase2;
public class TestDatadriven extends
ActivityInstrumentationTestCase2<CashTransferActivity_> {
private static final String TARGET_PACKAGE_ID =
"com.hlt.stocktrade.myaccount";
private static final String LAUNCHER_ACTIVITY_FULL_CLASSNAME =
"com.hlt.stocktrade.myaccount.CashTransferActivity_";
private static Class<?> launcherActivityClass;
Workbook wb;
WritableWorkbook copy;
WritableSheet sheet;
Boolean FuntionResult = false;
Cell rowData[] = null;
private String[] FirstValue;
private String[] SecondValue;
private String[] ThirdValue;
private String[] FourthValue;
private String[] FifthValue;
private String[] SixthValue;
int rowCount = '0';
WorkbookSettings ws = null;
Workbook workbook = null;
Sheet s = null;
String[] TestResults;
static {
try {
launcherActivityClass = Class
.forName(LAUNCHER_ACTIVITY_FULL_CLASSNAME);
} catch (ClassNotFoundException e) {
throw new RuntimeException("Class not found" + e);
}
}
Exception {
ws = null;
workbook = null;
s = null;
Attachment: TestDatadriven.java
Original issue: http://code.google.com/p/robotium/issues/detail?id=171
The text was updated successfully, but these errors were encountered: