RichTextFX icon indicating copy to clipboard operation
RichTextFX copied to clipboard

Add support for TestFX tests

Open JordanMartinez opened this issue 8 years ago • 13 comments

I fixed some issues yesterday but these fixes cannot be tested automatically to insure the fix works without screwing up something else. Could we add support to TestFX to insure the code runs properly? If so, I would love to integrate that with Spock so that parameterized tests would be easier to implement, but you've already expressed beforehand that you want to keep the languages we use down to a minimum.

JordanMartinez avatar Oct 04 '16 18:10 JordanMartinez

:+1: for TestFX.

I'm sure you can write parameterized tests with pure java test frameworks.

TomasMikula avatar Oct 04 '16 20:10 TomasMikula

I'm sure you can write parameterized tests with pure java test frameworks.

Oh you can, but Spock makes it easy to read via its table-like when block.

I'll look into the TestFX integration. I remember receiving a notification recently that there was an issue with it when it is run in headless mode, but I can't recall all of what that was.

JordanMartinez avatar Oct 04 '16 21:10 JordanMartinez

Just FYI, TestFX 4, as it currently stands right now, will be problematic to integrate into this project for two reasons: first, see TestFX/TestFX#290 and second, note how the development has been slowed severely (last commit was months ago, some PRs submitted a few months ago have yet to be merged (such as this one), and the developer even notes how busy he is).

We'd need to use TestFX 3, but I'm not sure what issues arise in that version.

JordanMartinez avatar Oct 04 '16 22:10 JordanMartinez

Well, then let's try to not have a dependency on TextFX. Anyway, I think that with these lines in Travis config, it should be OK to run tests that do graphical rendering, if that was the motivation.

TomasMikula avatar Oct 04 '16 22:10 TomasMikula

it should be OK to run tests that do graphical rendering, if that was the motivation.

Graphical rendering wasn't really the motivation. TestFX provides an FXRobot class that will simulate user interaction nicely.

JordanMartinez avatar Oct 04 '16 23:10 JordanMartinez

The current use case, #370, only needs firing a few events, which is not too difficult to do directly.

TomasMikula avatar Oct 04 '16 23:10 TomasMikula

I was also thinking of #357

JordanMartinez avatar Oct 05 '16 04:10 JordanMartinez

OK, that's tricky.

TomasMikula avatar Oct 05 '16 04:10 TomasMikula

I fixed the Shortcut issue, and currently a lot of activity is occurring on TestFX due to write access being granted to another person who has more time on their hands.

Still, my focus is on finishing the non-linear undo/redo commit in UndoFX. I hope to finish it by the end of December as I'll have a lot more time in a few weeks.

JordanMartinez avatar Dec 03 '16 03:12 JordanMartinez

Would someone mind writing a list of tests we should implement for this project via TestFX? I've written the javadoc for its core project as a way to learn how it works, so that shouldn't be too difficult to do now.

JordanMartinez avatar Dec 23 '16 19:12 JordanMartinez

I added the capability to write TestFX tests. However, we still need a list of tests to write.

JordanMartinez avatar Jan 17 '17 19:01 JordanMartinez

After writing #504, here's a few things that need to be figured out still:

  • [x] Add CI for Windows environment via AppVeyor: currently, only @TomasMikula can add the webhooks to make this possible. No doubt, he'll do that eventually.
  • [x] Figure out which of the currently-ignored tests should not be run on various OSes (for example, emitting a KeyCode.Paste on Linux does not work, but it does on Mac). Once the AppVeyor webhook gets set up, these can be easily figured out
  • [ ] Write tests that insure mouse-overriding code works correctly

JordanMartinez avatar May 26 '17 18:05 JordanMartinez

#517 failed because a test that is only supposed to run on Mac was run on Linux and times out. Strangely, this same test passed in Travis in the initial PR.

JordanMartinez avatar Jun 05 '17 15:06 JordanMartinez