Basic JUnit test for JavaFX 8

后端 未结 3 874
难免孤独
难免孤独 2020-11-27 19:19

I want to create basic JUnit test for JavaFX 8 application. I have this simple code sample:

public class Main extends Application {
    public static void ma         


        
3条回答
  •  青春惊慌失措
    2020-11-27 19:40

    Based on Brian Blonski 's answer I created a JUnit-Testrunner, that does essentially the same thing, but is a bit simpler to use in my opinion. Using it, your test would look like this:

    @RunWith( JfxTestRunner.class )
    public class MyUnitTest
    {
      @Test
      public void testMyMethod()
      {
       //...
      }
    }
    

提交回复
热议问题