Changeset 39017


Ignore:
Timestamp:
2024-05-12T21:01:06+12:00 (4 weeks ago)
Author:
anupama
Message:

Updating README to bring it up to speed with GLI GUI Testing instructions as they are at present.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gs3-extensions/testing/trunk/README_2024

    r39015 r39017  
    1 2024:
     1---------------------------
     2Notes written 2024:
     3---------------------------
    24I'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.
    35
    46But the following may be useful websites
    57- 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
     9Good 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
    611- https://junit.org/junit4/ (we appear to use junit4)
    712- 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
    813
     14
     150. Have a fresh GS3, preferrably a code checkout from SVN so that you can tweak the code on any errors.
     16
     17Then set up the environment:
     18     source ./gs3-setup.sh
    919
    10201. cd into GSDL3SRCHOME/ext and checkout the testing extension:
     
    1222svn co https://trac.greenstone.org/browser/gs3-extensions/testing/trunk/ testing
    1323
    14 2. Run the default target in its src folder, which is build-util-jar:
    15 /Scratch/ak19/gs3-svn-02May2024/ext/testing/src>ant
    1624
    17 3. I also ran
    18 ant compile-tutorials-test
     252. 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
     27GS3/ext/testing/src>ant
     28
     29
     303. Compile and run cycle:
     31ant build-all-jars *
    1932ant run-tutorials-test
    2033
    21 (See point 5 first)
     34(See point 5 first for EventDispatchThread/EDT exceptions encountered so far in GLI and fixes made)
    2235
    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).
    2439
    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.
     404. To terminate the auto GLI gui testing: Ctrl+Shift+A
    2841
    29 5. Running GLI immediately failed with event dispatch thread exceptions (EDT exceptions). To get past this basic issue,
     42You 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
     44NOTES:
     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.
     47On such an occasion, after 10 or 20 seconds the testing suite will stop by itself.
     48
     49
     505. Running GLI immediately failed with Event Dispatch Thread exceptions (EDT exceptions). To get past this basic issue,
    3051a.
    3152- 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()
     
    3657
    3758c. 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
     60These changes are documented in the svn diffs below.
     61
     62d. 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
     64More 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.
     65I'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
     67Reminder: 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
     69Pages 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
    3872
    3973
Note: See TracChangeset for help on using the changeset viewer.