element
element copied to clipboard
Element crashes for edge cases of loopCount and size of testData
Describe the bug
Element in each of the following cases:
Case 1
loopCount===0
and test data is empty (caused by filtering of test data)
The following error message occurs:
+0s info: Starting iteration 1
error -> failed Error: Test data exhausted, consider making it circular?
Case 2
test data is empty.
+0s error: flood element error: JSON file 'supports/test-data.json' loaded but contains no rows of data.
Element exited with error
Error: JSON file 'supports/test-data.json' loaded but contains no rows of data.
To Reproduce Case 1: Create a non-empty set of test data and filter it in the element test so the test data becomes empty. Case 2: Use empty test data.
Expected behavior No test is executed and no error is thrown.
Desktop (please complete the following information):
Flood cloud and local on ubuntu.
@torfmaster I looked into this, and this is actually the expected behaviour. If you run out of data, the test cannot continue as there's no data to continue loading the steps with, so your options are either to specify more data, and/or make it circular.
But maybe you have a unique use case which we should support?
I looked into this, and this is actually the expected behaviour.
I am not sure that this is expected. When setting loopCount
to zero I actually don't expect any tests to run for sure - but I also don't expect a crash. I could try to add bogus test data to catch this case but I think there is just extra logic for the edge cases which shouldn't be there:
- if amount of test data == loopCount everything works fine
- but if
loopCount==0
throw an error - if
loopCount==0
and testdata is empty throw an error
I guess the second and the third could be removed.
I actually have a not-so-unique test case where it would be nice to support this: We have a two-step (split up in two test executions) performance test with unique test data per browser. The first step can fail and the second step can't continue with the test datum used in the first step so it is deleted from the test data. It can occur that there is a single browser on some node which doesn't have test data to process and hence the whole test execution fails - which it shouldn't.
I can try to create a PR fixing this behavior once I have found the piece of code that causes it.