Use xls as data connector problem

Ranorex Spy, Recorder, and Studio.
monkey2012
Posts: 77
Joined: Wed Sep 26, 2012 8:15 pm

Use xls as data connector problem

Post by monkey2012 » Thu Nov 29, 2012 8:47 pm

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'."

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Use xls as data connector problem

Post by Support Team » Fri Nov 30, 2012 9:38 am

Hi,

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

Regards,
Markus
.
Image

monkey2012
Posts: 77
Joined: Wed Sep 26, 2012 8:15 pm

Re: Use xls as data connector problem

Post by monkey2012 » Fri Nov 30, 2012 3:15 pm

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.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Use xls as data connector problem

Post by Support Team » Fri Nov 30, 2012 4:41 pm

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
.
Image

monkey2012
Posts: 77
Joined: Wed Sep 26, 2012 8:15 pm

Re: Use xls as data connector problem

Post by monkey2012 » Fri Nov 30, 2012 6:29 pm

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

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Use xls as data connector problem

Post by Support Team » Mon Dec 03, 2012 11:22 am

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
.
Image

monkey2012
Posts: 77
Joined: Wed Sep 26, 2012 8:15 pm

Re: Use xls as data connector problem

Post by monkey2012 » Mon Dec 03, 2012 4:22 pm

Meaning that I have add the following:

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

Thanks

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Use xls as data connector problem

Post by Support Team » Tue Dec 04, 2012 9:47 am

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
.
Image

monkey2012
Posts: 77
Joined: Wed Sep 26, 2012 8:15 pm

Re: Use xls as data connector problem

Post by monkey2012 » Tue Dec 04, 2012 4:12 pm

That works.

Thanks