1. Testing JavaFX UI Tips from JavaFX quality team Alexandre (Shura) Iline Java and JavaFX quality architect Oracle
2. The following is intended to outline our general product direction. It is intended for information purposes, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle's products remains at the sole discretion of Oracle.
8. UI testing … by Wikipedia «GUI software testing is the process of testing a product that uses a graphical user interface, to ensure it meets its written specifications.»
9. UI testing … most often ... «Checking whether usage of a product UI leads to results expected by the the person who performs testing »
18. UI Testing Manual Automated Initial step Design test specification. Create tests. Establish regular runs. Ongoing Click, click, click Analyze results File bugs Change the specification Change the tests Qualification High, low for test executors High Effectiveness Low High Other Inexpensive to start Continuous quality monitoring , inexpensive to reuse Fun Bo-o-o-ring Much like programming
20. Continuous build with testing No No Yes Yes. = Compilation successful Success Passed
21. Automation approach Record && Replay Coding Test creation Inexpensive* Usually just repeating manual test in special environment Must be accompanied by other means Expensive* Consists of programming Test execution Does not depend on approach Test maintenance Higher (in most cases)* Very much depends on test format Lower* Depends on principles of building test library Test analysis Does not depend on approach (*) Much more information closer to the end of this presentation
23. Jemmy v2 Started as a tool to tests TeamWare UI (1999) Used for NetBeans extensions (2000) Official test tool for NetBeans (2001) Open-source (2001) Jemmy v3 Started in (2008) as a proof of concept experiment Extended to support JavaFX (2009) Open-source with support of JavaFX 1.2 (2009) Developed in close-source for 1.3 since then
28. Jemmy v3 Covered in this presentation JavaFX AWT/Swing SWT Scenegraph LCDUI JemmyCore Interfaces AWT robot FX robot Hierarchy Input Scene, node containers Scroller, slider, list, text, ... Generic interfaces
29. UI test Find Do Verify Pass Pass Pass Fail Fail Fail Failure analysis Find next control To perform operation On in Verify that expected State reached Perform necessary actions
39. Interfaces Interface Control types Description Mouse, Keyboard, Drag Anything Low level input Parent Containers, list (for its content) Something you could look within Selectable Toggle button, radio button, combo box , check box, lists, etc A control which provides limited number of choices CaretOwner Text box, scroll bar, slider A control which has a number value which changes within some range Text Text box Editable text container
41. Verifications UI feedback Non UI feedback Dialog displayed Text changed Image updated Progress bar changed position File created Database updated Sunset happened :)
46. E A – automation effectiveness N R and N C are characteristics for a product. T M is a characteristic of a test suite T D and T S depend on test automation approach Smaller T D and T S - higher the E A . T D + * T S N R T M * N R N C * E A = N C *
47. Assumptions: T M = 1 engineer*week T S = 0.1 * T M T D = 5 * T M N R = 8
48. T d or T s – what to minimize T S - if (N C * N R ) is big Multi-platform Compatibility with external products (servers, browsers, ...) Long-living T D - if (N C * N R ) is small Proof of concept Preview
49. Tests fail every now and then ... … because the tested UI is changed
50. Tests fail every now and then ... Ah! And also because errors are made ...
52. T s components Time spent on What to do %% of time Allocating failures Use test harness 1% - 5% Understanding the failure reason Use test logging, save images, save UI state 10% - 80% Fix the tests Move common code to the library ( * ) 90% - 10% (*) The only way it is different from programming is that there are a lot of tests. More on this later.
54. Understanding failure Logging UI operations Going to push ... button Selecting ... menu UI responses Found list view: … UI hierarchy Scene «…» Group «…» Button «…» UI states Images
63. Remember the formula? T D + * T S N R T M * N R N C * E A = N C * E A – automation effectiveness To be used for every particular product. N R and N C are unique for a product. T M is a characteristic of a test suite. Smaller T D and T S - higher the E A . Coefficient depend on the way you write your tests
64. T S mainly consists of time for test modification. When product changes, tests need to be changed accordingly. Many tests! Hundreds. “ Less changes of test code per a change in the product UI.” Ideally ... no more than one. But ... how? You are the coders – you know: Move code to test library.
Note that in reality all the verifications should be done throwg waiting
Effectiveness is estimated under assumption that the testing is thorough and there are many tests
This is a well accepted practice nowadays. However it is not really possible without testing. And it is not really possible with manual testing as the turnaround is too long to rely on.
This is a well accepted practice nowadays. However it is not really possible without testing. And it is not really possible with manual testing as the turnaround is too long to rely on.
If we get to it, I will be showing figures which explain why do we think so
It is not a toy
ditto
The values of course depend on how the fast product is changing The estimations are for NetBeans – we went through this stage Now would happen if the combo-box is replaced by color chooser page up test would fail, 'cause it's looking for combo-box page down Most importantly ... all tests would fail!