
@robby How do I use framework/test
? When I run the example from the docs, it just loops forever: #lang racket
(require framework/test)
(test:menu-select "File" "New Tab")
and I need to break it.

(I’d like to automate some tests for Quickscript, finally!)

Or maybe I need to run the program outside the target drracket window and make sure the X window manager has focus on the drracket window? I’ll try that later.

Doesn’t seem to work when run from an external repl, with (sleep 1)
to give me time to switch to DrRacket’s window.

Maybe you calling it from the wrong thread?

It needs to be called from a thread that isn’t the event space main thread

I’m a little confused it seems. This #lang racket
(require framework/test)
(thread
(λ ()
(sleep 2)
(test:menu-select "File" "New Tab")))
(read-line)
raises: .../framework/test.rkt:633:6: test:menu-select: no active frame

From within DrRacket

Same if I run from the terminal and switch to DrRacket’s window in the 2s interval

Looking at https://github.com/racket/drracket/blob/master/drracket-test/tests/drracket/private/run-example-tool.rkt it seems there’s a looot more stuff to do to make this work

Aha, after installing drracket-test
, I could get this one to work: https://github.com/racket/drracket/blob/master/drracket-test/tests/drracket/insert-large-letters-test.rkt which should be a good starting point. I guess I’ll have to make a separate quickscript-test package that depends on drracket-test
then.

You need to be on the same eventspace but on a different thread.

In the message starting with “I’m a little confused it seems” you were on a different eventspace.

When you tried it in a racket run from the terminal you were not in the same process (so thus also not on the same eventspace)

Ok so i need to start drracket from my module with drracket/tool-lib and start a second thread to control it then?

probably I should document some of the helper functions that I have set up for drracket’s own test suite

I have this now: #lang racket
(require tests/drracket/private/drracket-test-util
drracket/private/local-member-names
racket/gui/base
framework
rackunit
string-constants)
(fire-up-drracket-and-run-tests
(λ ()
(define drr (wait-for-drracket-frame))
(queue-callback/res (λ () (send (send drr get-definitions-canvas) focus)))
(test:menu-select "Scripts" "Tests" "string-insert")
(test:menu-select "Scripts" "Tests" "string-reverse")
#t))
The first script is called correctly, but it seems to hang before the second. Is there something I must do between the two test:menu-select
calls?

No

Maybe quickscript has a race condition

?

@laurent.orseau that coe, I believe, corresponds to a user clicking very quickly first on the string-insert menu item and then on the string-reverse one.

It should be a legal set of inputs to quick script.

I guess.

:slightly_smiling_face:

There’s no thread in quickscript, but maybe drracket plugins are threaded?