# How do you use testing in your projects?

**URL:** https://clojureverse.org/t/how-do-you-use-testing-in-your-projects/5576
**Category:** Watercooler
**Tags:** clojure, clojurescript
**Created:** [March 7, 2020, 1:56pm UTC](https://clojureverse.org/t/how-do-you-use-testing-in-your-projects/5576 "2020-03-07T13:56:26Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![Webdev\_Tory](https://clojureverse.org/user_avatar/clojureverse.org/webdev_tory/32/3781_2.png) [@Webdev\_Tory](https://clojureverse.org/u/Webdev_Tory)
#### Post date: [March 7, 2020, 1:56pm UTC](https://clojureverse.org/t/how-do-you-use-testing-in-your-projects/5576/1 "2020-03-07T13:56:26Z")

</div>

I’m curious about the variety of methods used by developers for testing in [some of] your primary project[s], and would value your participation in a little survey. Please comment with any further explanation or questions you have!

**What is the scale of your project (not counting libraries)?**

_Poll ([view on site](https://clojureverse.org/t/how-do-you-use-testing-in-your-projects/5576/1))_

**What flavor of platform are you targeting?**

_Poll ([view on site](https://clojureverse.org/t/how-do-you-use-testing-in-your-projects/5576/1))_

**What forms of testing do you do?**

_Poll ([view on site](https://clojureverse.org/t/how-do-you-use-testing-in-your-projects/5576/1))_

**What testing frameworks/libraries do you leverage?**

_Poll ([view on site](https://clojureverse.org/t/how-do-you-use-testing-in-your-projects/5576/1))_

---

<div class="post-metadata">

### Author: ![daslu](https://clojureverse.org/user_avatar/clojureverse.org/daslu/32/4173_2.png) [@daslu](https://clojureverse.org/u/daslu)
#### Post date: [March 7, 2020, 3:11pm UTC](https://clojureverse.org/t/how-do-you-use-testing-in-your-projects/5576/2 "2020-03-07T15:11:26Z")

</div>

In the past, I enjoyed hara.test, that auto-generates of docstrings from tests.  
See example [here](https://github.com/scicloj/hara-test-example).

Now experimenting with [notespace](https://github.com/scicloj/notespace), that [supports basic unit-testing](https://scicloj.github.io/notespace/resources/public/notespace/v2/tutorial-test/index.html#Tests) in the form of a literate-programming document.

---

<div class="post-metadata">

### Author: ![didibus](https://clojureverse.org/user_avatar/clojureverse.org/didibus/32/951_2.png) [@didibus](https://clojureverse.org/u/didibus)
#### Post date: [March 7, 2020, 6:05pm UTC](https://clojureverse.org/t/how-do-you-use-testing-in-your-projects/5576/3 "2020-03-07T18:05:30Z")

</div>

I also do functional testing (when you tests units together) and integration testing (when you test your app and it’s interaction with other apps).

And I also use the cognitect test runner: [https://github.com/cognitect-labs/test-runner](https://github.com/cognitect-labs/test-runner)

I also use clj-kondo [https://github.com/borkdude/clj-kondo](https://github.com/borkdude/clj-kondo) for linting.

---

<div class="post-metadata">

### Author: ![l3nz](https://clojureverse.org/user_avatar/clojureverse.org/l3nz/32/713_2.png) [@l3nz](https://clojureverse.org/u/l3nz)
#### Post date: [March 8, 2020, 3:23pm UTC](https://clojureverse.org/t/how-do-you-use-testing-in-your-projects/5576/4 "2020-03-08T15:23:42Z")

</div>

> [@didibus](#):
>
> I also use clj-kondo [GitHub - clj-kondo/clj-kondo: Static analyzer and linter for Clojure code that sparks joy](https://github.com/borkdude/clj-kondo) for linting.

Same here. Though it’s not related to testing, it’s in the same “assure quality” mental bucket for me.

---

<div class="post-metadata">

### Author: ![seancorfield](https://clojureverse.org/user_avatar/clojureverse.org/seancorfield/32/195_2.png) [@seancorfield](https://clojureverse.org/u/seancorfield)
#### Post date: [March 9, 2020, 12:20am UTC](https://clojureverse.org/t/how-do-you-use-testing-in-your-projects/5576/5 "2020-03-09T00:20:10Z")

</div>

We use [HtmlUnit](http://htmlunit.sourceforge.net/) to perform UAT-style end-to-end testing (as well as `clojure.test`, [`expectations.clojure.test`](https://github.com/clojure-expectations/clojure-test), generative testing, and property-based testing).

In terms of scale, at work, we have 72,953 lines of source code and 21,182 lines of test code.

---

<div class="post-metadata">

### Author: ![plexus](https://clojureverse.org/user_avatar/clojureverse.org/plexus/32/6_2.png) [@plexus](https://clojureverse.org/u/plexus)
#### Post date: [March 9, 2020, 1:08pm UTC](https://clojureverse.org/t/how-do-you-use-testing-in-your-projects/5576/6 "2020-03-09T13:08:03Z")

</div>

What to you is the difference between generative testing and property-based testing?

---

<div class="post-metadata">

### Author: ![Webdev\_Tory](https://clojureverse.org/user_avatar/clojureverse.org/webdev_tory/32/3781_2.png) [@Webdev\_Tory](https://clojureverse.org/u/Webdev_Tory)
#### Post date: [March 9, 2020, 3:49pm UTC](https://clojureverse.org/t/how-do-you-use-testing-in-your-projects/5576/7 "2020-03-09T15:49:29Z")

</div>

Good question. To be honest, I just included “property-based testing” because it’s a phrase I see a lot. In response to your question I looked at the following:

- [What is property-based testing?](https://hypothesis.works/articles/what-is-property-based-testing/) (not very enlightening)
- [Introduction to Property-Based Testing](https://medium.com/criteo-labs/introduction-to-property-based-testing-f5236229d237)
- [http://www.scalatest.org/user\_guide/property\_based\_testing](http://www.scalatest.org/user_guide/property_based_testing)

From these I gather that property-based testing originates with Haskell’s Quick Check system, and that Clojure’s generative testing via spec can be used to implement property-based checking. Reading online, it seems there isn’t a major difference.

---

<div class="post-metadata">

### Author: ![mvarela](https://clojureverse.org/user_avatar/clojureverse.org/mvarela/32/1478_2.png) [@mvarela](https://clojureverse.org/u/mvarela)
#### Post date: [March 9, 2020, 6:00pm UTC](https://clojureverse.org/t/how-do-you-use-testing-in-your-projects/5576/8 "2020-03-09T18:00:41Z")

</div>

> [@Webdev\_Tory](#):
>
> originates with Haskell’s Quick Check

Pedantic mode on: QuickCheck was originally written in/for Erlang, later ported to Haskell

---

<div class="post-metadata">

### Author: ![didibus](https://clojureverse.org/user_avatar/clojureverse.org/didibus/32/951_2.png) [@didibus](https://clojureverse.org/u/didibus)
#### Post date: [March 9, 2020, 7:53pm UTC](https://clojureverse.org/t/how-do-you-use-testing-in-your-projects/5576/9 "2020-03-09T19:53:05Z")

</div>

There is a difference between property and generative.

Generative testing relates to the test input. Which is generated instead of hard-coded. While property based testing relates to the assertions made, which asserts properties instead of hard-coded outputs.

So if you assert things like that your input/output always follow certain patterns, like that they are of an expected range, type, commutative, etc. That’s property based testing. You can do that even if you have hard-coded inputs.

With generative testing, you will most likely need property based assertions as well. Since if the input is generated, you can’t really have an assertion on the output that is an exact equality for the given input. So you’ll most likely won’t be able to assert it produced the exact expected output, but that at least it followed some generally applicable properties as they are expected.

So often times, generative testing implies property based tested, but not the other way around.

---

<div class="post-metadata">

### Author: ![Webdev\_Tory](https://clojureverse.org/user_avatar/clojureverse.org/webdev_tory/32/3781_2.png) [@Webdev\_Tory](https://clojureverse.org/u/Webdev_Tory)
#### Post date: [March 12, 2020, 3:33pm UTC](https://clojureverse.org/t/how-do-you-use-testing-in-your-projects/5576/10 "2020-03-12T15:33:26Z")

</div>

Those were my intuitions as to the difference between the two, but I hadn’t managed to articulate it so well to myself. Thanks for an excellent explanation!

---

<div class="post-metadata">

### Author: ![HolyJak](https://clojureverse.org/user_avatar/clojureverse.org/holyjak/32/1744_2.png) [@HolyJak](https://clojureverse.org/u/HolyJak)
#### Post date: [March 13, 2020, 6:51am UTC](https://clojureverse.org/t/how-do-you-use-testing-in-your-projects/5576/11 "2020-03-13T06:51:29Z")

</div>

> [@didibus](#):
>
> functional testing (when you tests units together)

Myself, I call that unit testing too - just with a larger unit 🙂 I think unit does not need to equal to a function.

---

<div class="post-metadata">

### Author: ![HolyJak](https://clojureverse.org/user_avatar/clojureverse.org/holyjak/32/1744_2.png) [@HolyJak](https://clojureverse.org/u/HolyJak)
#### Post date: [March 13, 2020, 7:00am UTC](https://clojureverse.org/t/how-do-you-use-testing-in-your-projects/5576/12 "2020-03-13T07:00:31Z")

</div>

We also to Specification by Example / BDD leveraging the Java SbE testing framework Concordion via [clj-concordion](https://github.com/holyjak/clj-concordion).

We have a ± smallish batch job of 180 functions with critical, money-related business functionality so testing the business rules and being able to have “living documentation” that shows the system is working correctly and that we can talk through with the business people is very important.

I have written about some of the stuff:

- [Applying Spec-based generative testing to a transformation pipeline - tips and lessons learned](https://blog.jakubholy.net/generative-testing-lessons-learned/)
- [Defeating Legacy Code with Living Documentation And Business-Level Tests](https://blog.jakubholy.net/defeating-legacy-code-with-living-documentation-and-business-level-tests/)
- ([Solution design in Java/OOP vs. Clojure/FP - I/O anywhere or at the boundaries? - experience](https://blog.jakubholy.net/design-in-java-vs-fp/) - Functional Core, Imprative Shell was crucial here)

---

<div class="post-metadata">

### Author: ![Webdev\_Tory](https://clojureverse.org/user_avatar/clojureverse.org/webdev_tory/32/3781_2.png) [@Webdev\_Tory](https://clojureverse.org/u/Webdev_Tory)
#### Post date: [March 13, 2020, 3:42pm UTC](https://clojureverse.org/t/how-do-you-use-testing-in-your-projects/5576/13 "2020-03-13T15:42:35Z")

</div>

BDD - that’s new to me! Thanks, and for the blog posts!

---

<div class="post-metadata">

### Author: ![system](https://clojureverse.org/uploads/default/original/2X/5/51079bf9e4b7d9466242c06cf1e43b9f8bd6da14.png) [@system](https://clojureverse.org/u/system)
#### Post date: [September 12, 2020, 3:42am UTC](https://clojureverse.org/t/how-do-you-use-testing-in-your-projects/5576/14 "2020-09-12T03:42:38Z")

</div>

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
