Testing Copy/Paste from Excel automatically
Posted: Mon Sep 24, 2012 5:09 pm
Hi,
one feature of our application is to allow the user simply copy/paste bigger tables ans save it.
Is it possible to record it via Ranorex?
I have tried to record the mouse movement but it was not successful.
Thank you for your help.
With kind regards
It is also OK, if Ranorex copies the complete table in our application
If I understand well this code should make it:
---------------------------------------------------------
TestData testData;
openFileDialog.DefaultExt = "xlsx";
openFileDialog.Filter = "XLS file (*.xls)|*.xls|XLSX file (*.xlsx)|*.xlsx|All files (*.*)|*.*";
if ( openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK )
{
this.tbExcelFile.Text = openFileDialog.FileName;
}
void InitExcelConnection()
{
string[] testDataInputs = new string[] { "Input1", "Input2", "Input3", "Input4" };
string[] testDataOutputs = new string[] { "Output1" };
if (System.IO.File.Exists(tbExcelFile.Text))
excelConnector = new ExcelConnector(this.tbExcelFile.Text,
testDataInputs, testDataOutputs, true,2);
else
throw new RanorexException(null,"Specified file does not exist!");
}
InitExcelConnection();
while ((testData = excelConnector.GetNext()) != null )
{
Ranorex.Control bt = null;
foreach (string str in testData.Inputs)
{
foreach (char c in str)
{
bt = calcForm.FindChildText(c.ToString());
Mouse.ClickControl(bt);
}
}
bt = calcForm.FindControlId(403);
// Compare calculator output with expected value
Ranorex.Validate.HasText(bt, testData.Outputs[0] + ", ",testData.Description + " validation",false);
}
---------------------------------------------------------
The question is where I put the path of the excel file and how to put the data in our form:
The path of the excel sheet:
D:\IntegrationTest\Mesap\MesapExplorer\MesapExplorer\Deskriptor
\Dimension_1000_Deskriptoren_hinfuegen.xlsx"
The path of the form: "/form[@title~'^Neue\ Deskriptoren\ anlegen']/element/element[1]"
It would be of course much better if CSV instead of XLS benutzt werden könnte. Is there any waxy to make (in this case of course not via Copy / Paste )
I.
one feature of our application is to allow the user simply copy/paste bigger tables ans save it.
Is it possible to record it via Ranorex?
I have tried to record the mouse movement but it was not successful.
Thank you for your help.
With kind regards
It is also OK, if Ranorex copies the complete table in our application
If I understand well this code should make it:
---------------------------------------------------------
TestData testData;
openFileDialog.DefaultExt = "xlsx";
openFileDialog.Filter = "XLS file (*.xls)|*.xls|XLSX file (*.xlsx)|*.xlsx|All files (*.*)|*.*";
if ( openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK )
{
this.tbExcelFile.Text = openFileDialog.FileName;
}
void InitExcelConnection()
{
string[] testDataInputs = new string[] { "Input1", "Input2", "Input3", "Input4" };
string[] testDataOutputs = new string[] { "Output1" };
if (System.IO.File.Exists(tbExcelFile.Text))
excelConnector = new ExcelConnector(this.tbExcelFile.Text,
testDataInputs, testDataOutputs, true,2);
else
throw new RanorexException(null,"Specified file does not exist!");
}
InitExcelConnection();
while ((testData = excelConnector.GetNext()) != null )
{
Ranorex.Control bt = null;
foreach (string str in testData.Inputs)
{
foreach (char c in str)
{
bt = calcForm.FindChildText(c.ToString());
Mouse.ClickControl(bt);
}
}
bt = calcForm.FindControlId(403);
// Compare calculator output with expected value
Ranorex.Validate.HasText(bt, testData.Outputs[0] + ", ",testData.Description + " validation",false);
}
---------------------------------------------------------
The question is where I put the path of the excel file and how to put the data in our form:
The path of the excel sheet:
D:\IntegrationTest\Mesap\MesapExplorer\MesapExplorer\Deskriptor
\Dimension_1000_Deskriptoren_hinfuegen.xlsx"
The path of the form: "/form[@title~'^Neue\ Deskriptoren\ anlegen']/element/element[1]"
It would be of course much better if CSV instead of XLS benutzt werden könnte. Is there any waxy to make (in this case of course not via Copy / Paste )
I.