Changeset 39017
- Timestamp:
- 2024-05-12T21:01:06+12:00 (4 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gs3-extensions/testing/trunk/README_2024
r39015 r39017 1 2024: 1 --------------------------- 2 Notes written 2024: 3 --------------------------- 2 4 I'm not sure what I read on junits, assertj swing and (if anything) on selenium to start off the automated gli testing work back in 2018, but here's what I can gather from current code. 3 5 4 6 But the following may be useful websites 5 7 - interspersed throughout our code that uses assert swing, I find I'd added references to this website: https://joel-costigliola.github.io/assertj/assertj-swing-basics.html 8 9 Good page for finding dialogs/windows, even if they may appear at some point in time: https://joel-costigliola.github.io/assertj/assertj-swing-lookup.html 10 6 11 - https://junit.org/junit4/ (we appear to use junit4) 7 12 - there's also the older wiki page by Sam that has his own work (not yet incorporated): https://wiki.greenstone.org/doku.php?id=internal:gs3_automated_testing 8 13 14 15 0. Have a fresh GS3, preferrably a code checkout from SVN so that you can tweak the code on any errors. 16 17 Then set up the environment: 18 source ./gs3-setup.sh 9 19 10 20 1. cd into GSDL3SRCHOME/ext and checkout the testing extension: … … 12 22 svn co https://trac.greenstone.org/browser/gs3-extensions/testing/trunk/ testing 13 23 14 2. Run the default target in its src folder, which is build-util-jar:15 /Scratch/ak19/gs3-svn-02May2024/ext/testing/src>ant16 24 17 3. I also ran 18 ant compile-tutorials-test 25 2. Run the default target in its src folder, which is build-tutorials-jar (which builds both the helper functions and the sequence of testing helper functions that get run) 26 27 GS3/ext/testing/src>ant 28 29 30 3. Compile and run cycle: 31 ant build-all-jars * 19 32 ant run-tutorials-test 20 33 21 (See point 5 first )34 (See point 5 first for EventDispatchThread/EDT exceptions encountered so far in GLI and fixes made) 22 35 23 4. To stop auto GLI: Ctrl+Shift+A 36 *build-all-jars calls ant targets: 37 - build-util-jar: to compile up the testing helper function in GSGUITestingUtil.java (and in future hopefully also GSTestingUtil.java that will have helper functions using Selenium to test out web browser behaviour) 38 - compile-tutorials-tests: to compile and jar up RunTestGLI.java, the sequence of steps that make up a test (like the sequnce of actions to complete the test of a GS3 tutorial). 24 39 25 When GLI runs automatically, it's very modal and there's no stopping it with random key presses. 26 To stop GLI running, RunTestGLI.java documents we need to press Ctrl+Shift+A 27 Until it's done or an exception terminates the automated testing prematurely, it won't otherwise stop. 40 4. To terminate the auto GLI gui testing: Ctrl+Shift+A 28 41 29 5. Running GLI immediately failed with event dispatch thread exceptions (EDT exceptions). To get past this basic issue, 42 You may further need to close the browser window and then may still need to press Ctrl-C in the terminal to return the prompt. 43 44 NOTES: 45 * When GLI runs automatically, it's very modal and there's no stopping it with random key presses. To stop GLI running, RunTestGLI.java documents we need to press Ctrl+Shift+A. Until the testing is done or an exception terminates the automated testing prematurely, testing won't otherwise stop. 46 * There are occasions when Ctrl+Shift+A has no effect, on rare cases of unexpected popups that appear that are not part of the streamlined testing as set out and then the whole testing stops. 47 On such an occasion, after 10 or 20 seconds the testing suite will stop by itself. 48 49 50 5. Running GLI immediately failed with Event Dispatch Thread exceptions (EDT exceptions). To get past this basic issue, 30 51 a. 31 52 - either in GathererProg.java I needed to move the instantiation of Gatherer into the SwingUtilities.invokeLater()'s run() at the bottom of GathererProg.main(), before gatherer.openGUI() … … 36 57 37 58 c. Then I can run "ant run-tutorials-test" and it jogs along OK automatically launching and interacting with GLI until it hits the snag I remember from long ago: the ProgressBar holding us up. 59 60 These changes are documented in the svn diffs below. 61 62 d. Many more such changes to GLI have now been made that I haven't here documented and would like to commit to svn with Dr Bainbridge's permission, after he looks them over (or a sample of them). 63 64 More such changes may continue to be necessary as our testing expands to try more and more branches of GLI's code and EDT exceptions get triggered and get fixed. 65 I'd prefer to commit all EDT related changes to GLI all in one go, at least on a "per tutorial" basis (per working test sequence of steps/actions that exercise a tutorial). 66 67 Reminder: to shift code into the Event Dispatch Thread/EDT, there's SwingUtilities.invokeLater(), which is asynchronous. To be synchronous (code that Must happen now because the code that follows is dependent on results/successful finish of the sequence of events being shifted into the EDT), use SwingUtilities.invokeAndWait() in a try/catch. 68 69 Pages that are useful 70 - https://joel-costigliola.github.io/assertj/swing/api/org/assertj/swing/exception/EdtViolationException.html 71 - VERY USEFUL BASICS: https://docs.oracle.com/javase/6/docs/api/javax/swing/package-summary.html#threading 38 72 39 73
Note:
See TracChangeset
for help on using the changeset viewer.