Hi, I have stumbled across an odd issue. Some of my tests rely on a data source which is a csv file which has a single line of data in it. If the file itself is missing, the test run fails at the very first step, which is correct.
However, if that same file is present, but has no data in it at all, only a warning is shown instead of the test failing.
Is this expected behaviour? If it is (which seems strange to me if it is), how would I get the test & test run to fail?
Edit:
I've realised that I should have added that this is Ranorex v8.2.1 and on a Windows 10 machine.
Test doesn't fail when there is no data in the data source
Test doesn't fail when there is no data in the data source
You do not have the required permissions to view the files attached to this post.
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Test doesn't fail when there is no data in the data source
Hello JimLin,
You could create a user code method to check if a data connector has data:
Note: The code needs to be executed before your test case, since a test case with an empty data connector is simply skipped
Sincerely,
Robert
You could create a user code method to check if a data connector has data:
var suite = (TestSuite)TestSuite.Current; var dataCache = suite.DataConnectorManager.GetDataCacheByConnectorName("NameOfYourConnector"); if (dataCache.Rows.Count == 0) { throw new RanorexException("No data within data source"); }
Note: The code needs to be executed before your test case, since a test case with an empty data connector is simply skipped
Sincerely,
Robert
Re: Test doesn't fail when there is no data in the data source
Hi Robert,
Although it's nice to learn about an option to check the data source availability, I think that the test should definitely fail by itself, if there is no data source availability code implemented? I too was confused by the fact that the test stated Success, even though the data were missing
Although it's nice to learn about an option to check the data source availability, I think that the test should definitely fail by itself, if there is no data source availability code implemented? I too was confused by the fact that the test stated Success, even though the data were missing
Last edited by odklizec on Thu Dec 27, 2018 10:13 am, edited 1 time in total.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: Test doesn't fail when there is no data in the data source
Hi odklizec and Robert,
Thank you for your replies.
I will raise a post in the bug report section of the forum and look at implementing the work round.
Have a good xmas.
Cheers James
Thank you for your replies.
I will raise a post in the bug report section of the forum and look at implementing the work round.
Have a good xmas.
Cheers James
Re: Test doesn't fail when there is no data in the data source
Actually Robert, please could you move this to the bug forum for me, as it would be better than me duplicating it.
Cheers,
James
Cheers,
James
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Test doesn't fail when there is no data in the data source
Hello James,
I moved the topic to "Bug Reports" and added an issue in our bug tracking system.
Thank you!
Regards,
Bernhard
I moved the topic to "Bug Reports" and added an issue in our bug tracking system.
Thank you!
Regards,
Bernhard
Re: Test doesn't fail when there is no data in the data source
Hi Robert, Bernhard,
Following the xmas break, I have finally implemented the workaround. Unfortunately, although the code throws an error for the module failing, as can be seen below, the test case/test suite still doesn't fail and shows as 'Success'.
Regards,
James
Following the xmas break, I have finally implemented the workaround. Unfortunately, although the code throws an error for the module failing, as can be seen below, the test case/test suite still doesn't fail and shows as 'Success'.
Regards,
James
You do not have the required permissions to view the files attached to this post.
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Test doesn't fail when there is no data in the data source
Hello James,
Happy new year!
I'm afraid this doesn't work in the setup region of the test suite. In order to get an error in the pie chart, you would have to slightly change the structure of your test case. You will need a test case that fails to get the error in the report. You can add smart folders as a workaround.
Sincerely,
Bernhard
Happy new year!
I'm afraid this doesn't work in the setup region of the test suite. In order to get an error in the pie chart, you would have to slightly change the structure of your test case. You will need a test case that fails to get the error in the report. You can add smart folders as a workaround.
Sincerely,
Bernhard
You do not have the required permissions to view the files attached to this post.