Sorry Benjamin, my description of what is going on with these tests may have been a bit misleading.
The
tests I wrote should ALWAYS pass. One test simply types some text into a
field and then verifies that the field contains the text. The other
clicks on one field, verifies it is focused, then sends a TAB key and
verifies that the focus has changed to a second field.
When run
by themselves, the tests always pass. But when run in quick succession
(by duplicating the tests in the test class), they fail sporadically. As an example, the first test is just these 2 lines:
clickOn("#field1").push(KeyCode.CONTROL, KeyCode.A).write("new text").push(KeyCode.TAB);
Assert.assertEquals("new text", _field1.getText());
When the test is repeated 10 times in quick succession in the JUnit test suite, it occasionally fails. The exception comes from within the clickOn() TestFx method, with a
java.util.ConcurrentModificationException
at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:386)
I originally thought this had something to do with event handlers on the fields. But commenting out the code that adds the listeners to the text fields does not remove the problem (it does seem to make it less frequent). So I am baffled at how the clickOn() method can generate a ConcurrentModificationException when nothing else should be happening in the UI.
I've simplified the test to the point that I can no longer manufacture a theory on how my test code could be at fault. I've attached a simplified version (SporadicFailures2.java). It fails less often in this version - I frequently need to run the test suite 4-5 times before it will fail. Sometimes 9 or 10 times. But eventually, one test will fail.
Can anyone help me understand how this simple test could fail in this inconsistent manner? What am I doing wrong?
Thanks!
Chris
On Sunday, February 5, 2017 at 1:47:25 PM UTC-5, Benjamin Gudehus wrote:
Hi Chris,
so you say SporadicFailures.java fails (inconsistently) on headless (Glass robot) and non-headless (AWT robot)?
--Benjamin
Sorry...forgot to attach the code! SporadicFailures.java is attached.
--
You received this message because you are subscribed to the Google Groups "TestFX" group.