testing

nottmey 2022-04-25T09:07:40.079689Z

Hi, one question regarding https://github.com/hyperfiddle/rcf and IntelliJ Idea (with Cursive): How do I configure the Run/Debug Config, so that I can test the generated tests with the intellij tooling? Edit: Basically I’m asking how to configure {:aliases {:test {:jvm-opts ["-Dhyperfiddle.rcf.generate-tests=true"]}}} + clj -M:test -e "(require 'example)(clojure.test/run-tests 'example)" as clojure.test execution

nottmey 2022-04-26T20:54:30.152049Z

I think I don’t need to record a video. The question boils down to this: I have deps.edn

{:paths   ["src"]
 :deps    {com.datomic/client-api  {:mvn/version "1.0.58"}
           com.hyperfiddle/rcf     {:mvn/version "20220405"}
           com.walmartlabs/lacinia {:mvn/version "1.1"}
           org.clojure/clojure     {:mvn/version "1.11.1"}}
 :aliases {:repl     {:extra-paths ["dev"]}
           :test     {:extra-paths ["test"]
                      :extra-deps  {io.github.cognitect-labs/test-runner
                                    {:git/tag "v0.5.0" :git/sha "b3fd0d2"}}
                      :main-opts   ["-m" "cognitect.test-runner"]
                      :exec-fn     cognitect.test-runner.api/test}
           ; clj -M:test-rcf -e "(require 'datomic-lacinia.utils)(clojure.test/run-tests 'datomic-lacinia.utils)"
           :test-rcf {:jvm-opts  ["-Dhyperfiddle.rcf.generate-tests=true"]}}}
How can I configure alias :test to also run the RCF tests?

Dustin Getz (Hyperfiddle) 2022-04-26T20:57:43.911529Z

You can put the JVM flag to generate clojure.test/deftests under :test but the problem is if you start moving or renaming tests at the REPL you will probably dangle old tests, because RCF tests do not have identity (they aren't named, clojure.test tests have names)

Dustin Getz (Hyperfiddle) 2022-04-26T20:58:07.252289Z

this issue: https://github.com/hyperfiddle/rcf/issues/41

Dustin Getz (Hyperfiddle) 2022-04-26T20:59:06.579889Z

We are planning to have that capability but no ETA, our next technical alpha needs to be released first

πŸ‘Œ 1
nottmey 2022-04-26T21:08:30.660949Z

hmm, I don’t know whether that would be an issue for me (since it’s single runs of clj -M:test ) when I put :jvm-opts ["-Dhyperfiddle.rcf.generate-tests=true"] into :test it doesn’t do anything because the testrunner ist only using the test dir. but when I provide src as test dir with

✘1 ➜ clj -M:test -d src                                                                              

Running tests in #{"src"}

Testing user

Ran 0 tests containing 0 assertions.
0 failures, 0 errors.
it doesn’t find the rcf tests πŸ€”

Dustin Getz (Hyperfiddle) 2022-04-26T21:15:24.924449Z

I think it means the namespaces aren't loaded, are you in control of the command line incantation?

Dustin Getz (Hyperfiddle) 2022-04-26T21:17:53.189999Z

e.g. i would expect this to work clj -M:test"(require 'datomic-lacinia.utils)(clojure.test/run-tests 'datomic-lacinia.utils)"

nottmey 2022-04-26T21:30:39.558359Z

sadly that doesn’t work even with -e variations But yes, I see why cognitect.test-runner is not picking up the RCF tests. The namespaces are not evaluated/loaded yet, and that’s why the macro expansion did not happen yet. (Well I think that whats going on.)

nottmey 2022-04-26T21:32:02.475829Z

success!

➜ clj -M:test -d src -n datomic-lacinia.utils                                                            

Running tests in #{"src"}

Testing datomic-lacinia.utils
βœ…βœ…βœ…βœ…βœ….βœ…βœ…βœ…βœ…βœ…βœ….βœ…βœ…βœ…βœ…βœ….
Ran 3 tests containing 16 assertions.
0 failures, 0 errors.

nottmey 2022-04-26T21:33:49.823849Z

ok, perfect, namespace regex does work too

➜ clj -M:test -d src -r "datomic-lacinia.*"

Running tests in #{"src"}

Testing datomic-lacinia.graphql
βœ….βœ…βœ…βœ….βœ….
Testing datomic-lacinia.types
βœ…βœ…βœ…βœ….βœ…βœ…βœ….
Testing datomic-lacinia.utils
βœ…βœ…βœ…βœ…βœ….βœ…βœ…βœ…βœ…βœ…βœ….βœ…βœ…βœ…βœ…βœ….
Ran 8 tests containing 28 assertions.
0 failures, 0 errors.

Dustin Getz (Hyperfiddle) 2022-04-26T21:34:08.010949Z

Great - do you have it working in Cursive now?

nottmey 2022-04-26T21:39:13.908059Z

sadly no, but clj -M:test works now with all tests

{:paths   ["src"]
 :deps    {com.datomic/client-api  {:mvn/version "1.0.58"}
           com.hyperfiddle/rcf     {:mvn/version "20220405"}
           com.walmartlabs/lacinia {:mvn/version "1.1"}
           org.clojure/clojure     {:mvn/version "1.11.1"}}
 :aliases {:repl     {:extra-paths ["dev"]}
           :test     {:extra-paths ["test"]
                      :extra-deps  {io.github.cognitect-labs/test-runner
                                    {:git/tag "v0.5.0" :git/sha "b3fd0d2"}}
                      :main-opts   ["-m" "cognitect.test-runner" "-d" "src" "-d" "test" "-r" "datomic-lacinia.*"]
                      :exec-fn     cognitect.test-runner.api/test
                      :jvm-opts    ["-Dhyperfiddle.rcf.generate-tests=true"]}}}
➜ clj -M:test

Running tests in #{"src" "test"}

Testing datomic-lacinia.graphql
βœ….βœ…βœ…βœ….βœ….
Testing datomic-lacinia.types
βœ…βœ…βœ…βœ….βœ…βœ…βœ….
Testing datomic-lacinia.utils
βœ…βœ…βœ…βœ…βœ….βœ…βœ…βœ…βœ…βœ…βœ….βœ…βœ…βœ…βœ…βœ….
Testing datomic-lacinia.schema-test
.
Ran 9 tests containing 29 assertions.
0 failures, 0 errors.

nottmey 2022-04-26T21:40:31.804859Z

cursive still just picks up the normal tests

nottmey 2022-04-26T21:40:53.594809Z

I guess it overrides some of the deps alias config πŸ˜•

Dustin Getz (Hyperfiddle) 2022-04-26T21:42:37.225269Z

Does the "parameters" field pass through to CLJ internally?

nottmey 2022-04-26T21:44:28.619049Z

I don’t know, it doesn’t seem to do anything πŸ˜…

nottmey 2022-04-26T21:50:02.090239Z

I guess I ask in #cursive whether they have any clues πŸ˜„ Thank you for helping and following along! πŸ™‡

Dustin Getz (Hyperfiddle) 2022-04-25T12:40:13.158709Z

Hi Malte, thank you for trying RCF! We don't know what this is: "so that I can test the generated tests with the intellij tooling" Can you take a Loom video of your old workflow that you desire to integrate with? So we can understand concretely, exactly what it is you want to do https://www.loom.com/ - a fast and easy way to record short videos and share a link in a couple clicks

Dustin Getz (Hyperfiddle) 2022-04-25T13:01:40.315269Z

1-2 screenshots would also probably suffice

nottmey 2022-04-25T13:23:42.979929Z

Hi Dustin, oh good question. I’ll try to capture a better example later. For now I found this: Basically I’m used to the β€œclojure.test” Test Runner here: https://cursive-ide.com/userguide/testing.html I’m wondering what to input in picture one and two to get testing feedback displayed similar to picture three and possibly four

πŸ‘€ 1