(This page is about testing Chestnut itself, not about how to do testing in your Chestnut app. For that see Testing Your App)
Because of the nature of Chestnut, testing it requires an interplay between terminal, repl, and browser. This is hard to automate, but we're trying anyway :) There are some basic tests available, but the test suite is not comprehensive.
For process control the tests depend on unreleased features of jnr-process, which in turn relies on unreleased code in jnr-posix. So clone those two repos and for each do mvn install
. I think that's the only dependencies you need to set up. Leiningen will figure out the rest.
To run the tests do lein test
. This will start with executing cd /tmp ; lein new chestnut --snapshot
, possibly with some options. So to run the tests against your local version, you have to first do a lein install
. Also make sure that if the tests are using --snapshot
, that the version you're installing ends with -SNAPSHOT
.
For WebDriver, the tests are currently set up to use Chrome, and to look for the chromedriver executable in ~/bin/chromedriver
. This might not be suitable for your system. Check the clj-webdriver docs and make sure it's able to open a browser. See src/chestnut/test/integration.clj
to twiddle with this. You can try this in a REPL to see if a browser pops up:
(System/setProperty "webdriver.chrome.driver" (str (System/getenv "HOME") "/bin/chromedriver"))
(use 'clj-webdriver.taxi)
(set-driver! {:browser :chrome} "https://github.com/plexus/chestnut")
Running these test takes time. There's a lot of JVM booting and shutting down, and it seems as the consecutive tests run this process actually becomes even slower. Because of this you might run into the problem where the test tries to boot a REPL, but this times out. To work around that you can add this to src/leiningen/new/chestnut/project.clj
, after which you do a new lein install
:repl-options {:timeout 200000} ;; Defaults to 30000 (30 seconds)
This is implemented now as an automated test, it will be executed for each of the feature flags.
@app-state
)s/h1/h2/
), watch the browser updateThis needs to be done for each of the feature flags.
These are features, some hidden behind feature flags, that should be verified manually
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close