reveal

kenny 2021-11-21T16:58:09.080800Z

Curious about how people think individual test assertions should be displayed. Test var results are shown in the first screenshot. If any assertion in the test var fails, it is marked with a yellow fail marker. Each test var runs many test assertions though. Each test assertion can succeed or fail. The test assertions do not have an identity like the test var they reside in. Cursive's test integration will show the output in a text like view (screenshot 2). Each test assertion failure is separated by some space. I can do that too. I could see that layout getting a bit overwhelming for cases where one test var has lots of test assertions. I was thinking an alternative view would be to add 1 more layer to the tree view. Under each test var, I show the assert-expr dispatch value (e.g., =) and line number. These would not be named since there's no identifier for them. For example, tree view would look like this: • example.test-ns ◦ unit-test1 ▪︎ 1. =:17 ▪︎ 2. =:19 ▪︎ 3. pos?:21 ▪︎ ... Thoughts?

kenny 2021-11-21T17:15:55.081300Z

I might even be able to open files in IntelliJ by clicking a link in. a stacktrace or line number! https://www.jetbrains.com/help/idea/opening-files-from-command-line.html

vlaaad 2021-11-21T20:09:53.082500Z

re idea: great find, that might be useful to integrate in reveal!

kenny 2021-11-21T20:11:39.082700Z

Agreed! Thoughts on how someone might configure something like that in the case they're not using Cursive?

vlaaad 2021-11-21T20:11:51.082900Z

re showing assertions: I'd go with clojure.test reporting semantics, e.g. not showing the assert-expr, but by default showing counters instead.

vlaaad 2021-11-21T20:12:37.083300Z

maybe it makes sense to add more layers in the tree view for testing contexts?

vlaaad 2021-11-21T20:13:34.083500Z

i.e. the ones available with clojure.test/*testing-contexts*

kenny 2021-11-21T20:13:54.083700Z

Ah yeah, that could be nice!

kenny 2021-11-21T20:14:44.083900Z

The thing I worry about with the layout Cursive shows is near impossible usability when testing output gets large. That text area used would be absolutely massive.

kenny 2021-11-21T20:15:22.084100Z

I do agree that it departs from native reporting semantics, which I don't particularly like. Maybe there's some middle ground like collapsible sections in the text area thing.

vlaaad 2021-11-21T20:17:17.084300Z

does it happen that outputs are large even per testing context in a single test?

kenny 2021-11-21T20:19:23.084500Z

Yeah. Often a testing context will wrap many individual assertions.

vlaaad 2021-11-21T20:19:57.084700Z

but is it an often case that individual assertions have big logs around them?

vlaaad 2021-11-21T20:20:53.084900Z

my worry here is that this tree might also get pretty huge if we have something like this:

(dotimes [_ 1000]
  (is ...)))

vlaaad 2021-11-21T20:21:39.085100Z

re open in text editor/IDE — I imagine a preference key that allows specifying some well-known editors, maybe with automatic inference to see if vscode/intellij is installed, maybe with option to provide a command string with substitutable places. Maybe it can be available as an action on vars/nses and things resolvable to vars/nses.

👍🏻 1
kenny 2021-11-21T20:22:18.085300Z

In our case, yes. We deal with very large data structures. That's a great point. We also have some test vars with 10s of thousands of asserts 😅 (generated from data, akin to gen tests).

kenny 2021-11-21T20:23:37.085900Z

What about Cursive's output style (test tree left & assertion view right) where the assertion view has collapsible sections?

vlaaad 2021-11-21T20:31:29.087500Z

oh

vlaaad 2021-11-21T20:32:19.087700Z

in that case I think it makes sense to make collapsible/expandable outputs

👍🏻 1
kenny 2021-11-21T20:33:15.088100Z

What component do you suggest I use? I see the accordion but only being able to open 1 section seems super limiting...

vlaaad 2021-11-21T20:33:58.088300Z

re Cursive's output style — I think it won't work for reveal, mainly because reveal is usually in "portrait mode", e.g. bigger in vertical direction

vlaaad 2021-11-21T20:34:41.088500Z

so generally it's "cheaper" to align stuff vertically in reveal instead of horizontally

✔️ 1
kenny 2021-11-21T20:37:55.089300Z

re testing context: Cursive does not include them in the test results tree view. I can easily include it, but I wonder if there was a reason he chose not to 🤔

vlaaad 2021-11-21T20:38:45.089500Z

I don't know

vlaaad 2021-11-21T20:39:03.089700Z

btw there is also a stack of testing vars in addition to testing contexts

vlaaad 2021-11-21T20:39:18.089900Z

clojure.test/*testing-vars*

vlaaad 2021-11-21T20:39:45.090100Z

e.g. if you do this:

vlaaad 2021-11-21T20:40:09.090400Z

(deftest foo
  (is ...))

(deftest bar
  (foo))

vlaaad 2021-11-21T20:40:58.090600Z

the is block will be in stack of bar and foo vars

vlaaad 2021-11-21T20:41:12.090800Z

not sure what to do with that 🤷

kenny 2021-11-21T20:43:59.091Z

Oh wow. TIL. Cursive ignores that nesting. Here's what it looks like when I run a test like that.

kenny 2021-11-21T20:44:40.091400Z

Oh wait. It looks like it adds it as a space delimited list in the test var name.

kenny 2021-11-21T20:45:57.091600Z

Yep. I can do that too. I wonder if people use that grouping mechanism in practice.

vlaaad 2021-11-21T21:36:13.092Z

they might, at least it's properly documented

kenny 2021-11-22T02:19:53.093600Z

Man, that testing-vars thing really messes stuff up. Gotta support it, but it adds some constraints. For example, before I was able to render all the tests that would run upfront. But now, I don't have a guarantee that the vars passed in represent the actual tests that will run. Basically, everything that was keyed by var can no longer be keyed by var 😢

kenny 2021-11-22T02:20:48.093800Z

(Cursive does this too -- dynamically adding tree items as they get discovered in test execution)

kenny 2021-11-21T19:35:59.082200Z

Is there a way to adjust the size ratio of the output and result panels? I tried to drag the dividing line, but it doesn't seem to work like that.

vlaaad 2021-11-21T20:06:56.082300Z

there is none!

kenny 2021-11-21T20:12:17.083100Z

Got it. Is it possible to add or is there some limitation?

vlaaad 2021-11-21T20:22:34.085600Z

No technical limitations.

👌🏻 1
vlaaad 2021-11-21T20:24:05.086100Z

There is some intentionality behind not allowing changing the size of open panels

kenny 2021-11-21T20:24:37.086300Z

Ah. What's the thinking?

vlaaad 2021-11-21T20:24:47.086500Z

I wanted to make default sizes as good as possible so there will be no need for tinkering with sizes

vlaaad 2021-11-21T20:25:26.086700Z

so you get a reasonably good view without doing anything

kenny 2021-11-21T20:26:37.086900Z

Makes sense. Perhaps there's some special conditions that would be better suited with specialized sizes?

vlaaad 2021-11-21T20:27:04.087100Z

There are some more things in this area I'm working on right now, e.g. maximizing the window with a shortcut (`F11`), so when you need to really focus on some view, it can be as big as possible

vlaaad 2021-11-21T20:29:44.087300Z

And other thing I want to do is opening views in new windows instead of result panels. This, combined with F11 to maximize allows you to make some view take basically the whole screen.

kenny 2021-11-21T20:34:52.088700Z

Cool! How would you control if a view opened in a new window or not? Something like combining shift+enter?

vlaaad 2021-11-21T20:35:08.089Z

exactly this!