Page 1 of 1

Use xls as data connector problem

Posted: Thu Nov 29, 2012 8:47 pm
by monkey2012
If my test case uses "Simple Data Table" as data connector, and if the test case is scheduled to be executed using Windows Task Scheduler from Computer Management; then the test case runs through the end of test.
But, if I use Excel file as data connector, same test, and I did check the box "Include File in Test Suite", and schedule test to run as the one above, the test fails with the following error:
"Failed to get rows from data source: Could not find the 'C:\Windows\system32\testdata_file1.xlsx'."

Re: Use xls as data connector problem

Posted: Fri Nov 30, 2012 9:38 am
by Support Team
Hi,

Could it be that you forgot to add your projects output directory to the "Start in" textfield of your task?

Regards,
Markus

Re: Use xls as data connector problem

Posted: Fri Nov 30, 2012 3:15 pm
by monkey2012
I never used that field and never change the setting of the task scheduler. The only difference is just changing from using Simple Data Table to Excel File.

Re: Use xls as data connector problem

Posted: Fri Nov 30, 2012 4:41 pm
by Support Team
Hello,

We tried to reproduce that issue, but in our case we didn't get the error message.
Could you please give us more information how you defined your excel data connector and how you are using the windows task scheduler?
Can you please tell us which version of Ranorex you are using and which operating system is installed?

Thank you!
Regards,
Bernhard

Re: Use xls as data connector problem

Posted: Fri Nov 30, 2012 6:29 pm
by monkey2012
System info: Windows 7 Professional, 32-bit OS
Ranorex: 3.3.0

At first I created excel file on Desktop, named testdata_file1.xlsx

1. Right-click on the test case, select Data Source
2. Select "Use Excel File..." from "New" picklist
3. For the "File Name" field, click on the button and browse to the "testdata_files.xlsx" on Desktop
4. Check the box "Include File in Test Suite"
5. Click "Apply" and then "Data Binding"
6. Select the test, right-click, and select "Run Selected Test Case" ==> The test runs successfully
7. Then I tried to run the test without using Ranorex Studio, I meant used Command Line. The test runs successfully
8. Finally, I tried to run the same test using Windows Scheduler, the test failed with error
9. However, I went back to Project1.rxtst and picked "Simple Data Table", created the table with same data as xlsx file; then start the test via Windows Scheduler, and did not modify anything for this task. ==> Test runs successfully

Within Task Scheduler's Edit Action window:
Action = Start a program
Program/script = "C:\Users\workstation\Documents\Ranorex\RanorexStudio Projects\Project1\Project1\bin\Debug\Project1.exe"

Add Arguments (Optional) = /tc:TestCase_1 /rf:C:\Users\workstation\Desktop\Logs\%S_%Y%M%D_%T.rxlog

Re: Use xls as data connector problem

Posted: Mon Dec 03, 2012 11:22 am
by Support Team
Hi,

I suppose the problem is because you forgot to copy the Excel file to "C:\Windows\system32" directory or because you forgot to specify the working directory.
You have to copy the excel to the mentioned directory or you have to specify the working directory (in the "Start in" text field of the task).
Ranorex searches for the Excel file in the directory where the executable is executed from (if you checked the "Copy File to Project" checkbox), and if there is no such file you will get the specific error message.

Regards,
Markus

Re: Use xls as data connector problem

Posted: Mon Dec 03, 2012 4:22 pm
by monkey2012
Meaning that I have add the following:

Start in (Optional) = ""C:\Users\workstation\Documents\Ranorex\RanorexStudio Projects\Project1\Project1\bin\Debug\"

Thanks

Re: Use xls as data connector problem

Posted: Tue Dec 04, 2012 9:47 am
by Support Team
Hi,

If your Excel file is placed in this directory then yes (it should be placed there if you checked the "Copy File to Project" checkbox).

Regards,
Markus

Re: Use xls as data connector problem

Posted: Tue Dec 04, 2012 4:12 pm
by monkey2012
That works.

Thanks