testfx

ScenicView 8.7.0 does not load the opened JAVA FX application in it to inspect the elements

断了今生、忘了曾经 提交于 2021-01-29 09:40:55
问题 I have ScenicView 8.7.0 installed with JDK 8. I need to inspect the JAVA FX application which is running on Ubuntu 16.04(Hope Linux version is not the concern). ScenicView does find the opened JAVA FX application as per the following logs, but in UI of ScenicView, no application is getting displayed. ["Scanning for JavaFX applications" message displayed in ScenicView with endless spinner]. Any help appreciated. At ScenicView terminal logs I am getting following lines Platform running

How to set 'headless' property in a Spring Boot test?

▼魔方 西西 提交于 2020-01-02 06:56:10
问题 I am testing using Spring Boot with JavaFX (Based on some excellent YouTube videos that explain this). To make it work with TestFX, I need to create the context like this: @Override public void init() throws Exception { SpringApplicationBuilder builder = new SpringApplicationBuilder(MyJavaFXApplication.class); builder.headless(false); // Needed for TestFX context = builder.run(getParameters().getRaw().stream().toArray(String[]::new)); FXMLLoader loader = new FXMLLoader(getClass().getResource(

JavaFX + maven + TestFX + monocle don't work together

天涯浪子 提交于 2019-12-20 03:13:44
问题 I have a small project for demonsration JavaFX + TestFX under maven. I use: Java(TM) SE Runtime Environment (build 1.8.0_40-b26) Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T21:29:23+04:00) Full source: https://github.com/alevohin/testfx-maven-example I have 2 problems that I cannot resolve: 1) When I start AppFXTest from IDE (IDEA), test fails with java.lang.ClassNotFoundException: com.sun.glass.ui.monocle.MonoclePlatformFactory at java.net.URLClassLoader

Accessing a TableRow's style data in a TableView

↘锁芯ラ 提交于 2019-12-12 10:23:00
问题 I'm trying to write some TestFX code that will loop through a TableView component and check the background colour for each row is set correctly. What I can't work out is how to actually construct the loop to go through the TableRows as opposed to the actual data. I've tried using sourceTable.getItems() but that just gives me access to the object containing the data. But I need to go lower down than that and actually examine the background-colour of the CSS tag. I know that a TableRow has a

Is TestFX compatible with Java 7?

廉价感情. 提交于 2019-12-12 05:19:37
问题 Running the following snippet (with JDK 7 set in Eclipse): import javafx.scene.Scene; import javafx.stage.Stage; import org.junit.Test; import org.testfx.framework.junit.ApplicationTest; public class BasicTestFxTest extends ApplicationTest { @Override public void start(Stage stage) throws Exception { Scene scene = new Scene(null, 800, 600); stage.setScene(scene); stage.show(); } @Test public void test() { System.out.println("This is not a test."); } } Results in the following exception: java

TestFx - How to test validation dialogs with no ids

≯℡__Kan透↙ 提交于 2019-12-10 10:44:22
问题 I have an application with grid of records and button insert. After clicking insert, there is a form, where you fill in data and click Ok for adding new record to the grid. After clicking Ok, there is validation which fires dialog with error informations, if any of the text fields do not match validation rules. Is there any posible way to test text on the dialog with textFx, if the dialog has no id? 回答1: This is an example for Alert based dialog: In your test: alert_dialog_has_header_and

Getting started with TestFx

自作多情 提交于 2019-12-10 10:34:40
问题 I'm having some trouble getting TestFx working with Oracle's JavaFx HelloWorld app: public class HelloWorld extends Application { public static void main(String[] args) { launch(args); } @Override public void start(Stage primaryStage) { primaryStage.setTitle("Hello World!"); Button btn = new Button(); btn.setText("Say 'Hello World'"); btn.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { System.out.println("Hello World!"); } }); StackPane root =

How to test JavaFX (MVC) Controller Logic?

旧时模样 提交于 2019-12-07 17:43:35
问题 How do we properly write unit/integration tests for the JavaFX Controller logic? Assuming the Controller class I'm testing is named LoadController , and it's unit test class is LoadControllerTest , my confusion stems from: If the LoadControllerTest class instantiates a new LoadController object via LoadController loadController = new LoadController(); I can then inject values into the controller via (many) setters. This seems the only way short of using reflection (legacy code). If I don't

Getting started with TestFx

故事扮演 提交于 2019-12-06 12:05:27
I'm having some trouble getting TestFx working with Oracle's JavaFx HelloWorld app: public class HelloWorld extends Application { public static void main(String[] args) { launch(args); } @Override public void start(Stage primaryStage) { primaryStage.setTitle("Hello World!"); Button btn = new Button(); btn.setText("Say 'Hello World'"); btn.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { System.out.println("Hello World!"); } }); StackPane root = new StackPane(); root.getChildren().add(btn); primaryStage.setScene(new Scene(root, 300, 250));

TestFx - How to test validation dialogs with no ids

最后都变了- 提交于 2019-12-06 06:16:44
I have an application with grid of records and button insert. After clicking insert, there is a form, where you fill in data and click Ok for adding new record to the grid. After clicking Ok, there is validation which fires dialog with error informations, if any of the text fields do not match validation rules. Is there any posible way to test text on the dialog with textFx, if the dialog has no id? This is an example for Alert based dialog: In your test: alert_dialog_has_header_and_content( "Removing 'Almaty' location", "Are you sure to remove this record?"); In you helper test class: public