Should a specification run multiple times?

2 views
Skip to first unread message

Jakub Holý

unread,
May 3, 2019, 3:44:34 AM5/3/19
to concordion-dev
Hello!

Is it correct that a specification is run twice when included in another spec. via `concordion:run` or is it a mistake in my implementation?

I have these specs:

resources/math/Algebra.md (contains [Addition](./algebra/Addition.md "c:run"))
resources/math/algebra/Addition.md

and when I run it I get this output:

...
file:///.../concordion/math/algebra/Addition.html
Successes: 2, Failures: 0

file:///.../concordion/math/algebra/Addition.html
Successes: 2, Failures: 0

file:///.../concordion/math/Algebra.html
Successes: 4, Failures: 0

Ran 2 tests containing 0 assertions.
0 failures, 0 errors.

As you can see, algebra.Addition is run twice, obviously once as a stand-alone specification and once via the run command. Is this the way it should be or not?

My implementation (adding support for clojure.test) is very simple, mostly replicating what Concordion JUnit 3 integration did:

  1. For each fixture class defined by the user (via deffixture), define a clojure.test test that calls my run-fixture (see below)
  2. The custom ClojureTestRunner finds a fixture class and also just invokes run-fixture (this time with suite? = false so that before/afterSuite is not run, which I understand is the expected behavior for linked specs)
  3. run-fixture itself is essentially copy-paste of integration.junit3.ConcordionTestCase, wrapping the fixture in a FixtureInstance and calling FixtureRunner.run - which goes through a results cache. So is there something wrong so that the results are not cached in my case - or are they actually cached but it does not show in the output?
Thank you!

Cheers, Jakub

PS: If you have any suggestions/critique regarding my implementation, I would really appreciate to hear that. (One is certainly I need to migrate to the new version of FixtureRunner.run that takes also "example".)

Tim Wright

unread,
May 3, 2019, 4:16:43 PM5/3/19
to Jakub Holý, concordion-dev

Hey Jakub,

Concordion has a run results cache (org.concordion.internal.cache.RunResultsCache) built into it that means it should only be running the fixtures once each per run. There's a chance your code is bypassing it - I can't remember where we access the cache.

Tim



--
You received this message because you are subscribed to the Google Groups "concordion-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to concordion-de...@googlegroups.com.
To post to this group, send email to concord...@googlegroups.com.
Visit this group at https://groups.google.com/group/concordion-dev.
To view this discussion on the web, visit https://groups.google.com/d/msgid/concordion-dev/CA%2BffqM2Vx5iU5WYPo7UcPW9H_ktnrSDYOqspJFtL7k7N2SiOvg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages