lazytest

Karol Wójcik 2024-11-30T09:17:37.264809Z

@karol.wojcik has joined the channel

Karol Wójcik 2024-11-30T16:11:17.179419Z

Hey, what are the opinions on Gherkin syntax. Will features defined in Gherkin through feature file be supported in lazytest?

Karol Wójcik 2024-12-02T10:30:45.777169Z

Looks cool. I’m still trying to wrap my head around cucumber. On paper it looks kinda nice to provide unified specification across team members, but my gut tells me it’s overkill and hard to maintain long term.

seancorfield 2024-11-30T16:46:17.176169Z

Personally, I think Gherkin syntax is horrible and there are already Clojure testing libraries out there that support it, if that's your jam, such as https://github.com/schmorgurken/schmorgurken https://github.com/jrwdunham/tegere https://github.com/danielmiladinov/burpless https://github.com/defsquare/scenari

👍 1
2024-12-02T01:50:32.420129Z

gherkin is like cucumber, right?

2024-12-02T01:50:59.650389Z

i thought about implementing this back in september but didn't have any reason to yet, so never followed through

2024-12-02T01:53:33.895019Z

tegere, as referenced in sean's list, returns the gherkin feature files as data, and exposes some helper functions so you can bind as you wish (writing on my phone, my apologies for mistakes)

(require
  '[tegere.steps :refer [registry Given When Then]]
  '[lazytest.core :as lt]
  '[lazytest.suite :as lt.s)

(Given "a {animal}" (fn [ctx animal] (assoc ctx :animal animal)))
(When "I give him a {fruit}"
  (fn [ctx fruit]
    (assoc ctx :current-suite (lt.s/suite {:doc fruit}))))
(Then "he is {emotion}"
  (fn [{actual-emotion :emotion :as ctx} emotion]
    (update-in ctx [:current-suite :children] conj (lt/it (str "he is " emotion) (lt/expect (= actual-emotion emotion))))))

2024-12-02T02:01:42.189819Z

and then you gotta figure out some way to run it from within lazytest, i'm not sure how that or any other lbirary works