Page 1 of 1

Testing Copy/Paste from Excel automatically

Posted: Mon Sep 24, 2012 5:09 pm
by ranisti
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.

Re: Testing Copy/Paste from Excel automatically

Posted: Wed Sep 26, 2012 12:18 pm
by Support Team
Hello,

How do you want to copy/paste the tables into your application? How do you normally past the table in your application without Ranorex? Could you please send us a Ranorex Snapshot file? It would also be helpful to explain the issue a little bit more detailed. Did you already try to paste the table with the 'right mouse click -> paste' functionality?

Regards,
Bernhard
Ranorex Support Team

Re: Testing Copy/Paste from Excel automatically

Posted: Wed Sep 26, 2012 2:17 pm
by ranisti
Hi,

I open normaly an Excel Sheet, select an area, RMT--> Copy --> I go in our app --> select a grid, RMT --> paste.

The problem is, that these steps cannot be recorded in Ranorex. I cannot record the step "selecting an area".

I will make Snapshot and upload it.

Regards,

I.

Re: Testing Copy/Paste from Excel automatically

Posted: Thu Sep 27, 2012 8:35 am
by artur_gadomski
Did you try Shift key down Click first cell, click Last Cell, Shift key up?