Printing Hooks for example - looking for details

4 views
Skip to first unread message

Andy Dingfelder

unread,
Nov 15, 2018, 8:18:45 PM11/15/18
to concordion
Hi All - apologies in advance for the long question

I'm looking to validate my meaning of the terms:
  • Suite
  • Specification
  • Example
Looking on the concordion docs, the following example is given:

suite contains:
     Product
         Theme 1
              Feature 1
                  Sub-Feature 1
                  Sub-Feature 2
              Feature 2

It would be great if the documentation could use the same terms for tests that the example gives
 - e.g. is Product = suite? and is Theme a Specification? and then Example a subFeature?  
And is there any term for the separate sub-conditions for each row run within an example (markdown) table?

e.g. is the structure:
  • Suite
    • Specification1
      • Example1.1
        • then sub-conditions?
      • Example1.2
    • Specification2
      • Example2.1
      • Example2.2
__________________________________________________________


Trying to make sure I understand the terms correctly, I made a simple test class 
It's base class contains:


@BeforeSuite
def printMessageBeforeSuite() {
log.debug("printing message before Suite")
}
@BeforeSuite
def printMessageAfterSuite() {
log.debug("printing message after Suite")
}

@BeforeSpecification
def printMessageBeforeSpecification() {
log.debug(" printing message before Specification")
}

@AfterSpecification
def printMessageAfterSpecification() {
log.debug(" printing message after Specification")
}

@BeforeExample
def printMessageBeforeExample() {
log.debug(" printing message before Example")
}

@AfterExample
def printMessageAfterExample() {
log.debug(" printing message after Example")
}__________________________________________________________


When I run one test spec, the output contained:

printing message before example
printing message after example

I'm guessing this doesn't print Suite messages because a "suite" only runs when a test runs other tests (as a wrapper using the run command)?

__________________________________________________________

So I created a suite e.g. 

MyExampleTestSuite
 -- MyExampleTest1
 -- MyExampleTest2

The suite contains

- **[MyExampleTest1](MyExampleTest1.md "c:run")**
- **[MyExampleTest2](MyExampleTest2.md "c:run")**

__________________________________________________________

The example tests inherit from the base class (so they get the before/after hooks) and contain examples like:

# **Example Test1**

**Given** some condition

**Then** something should happen

| [run][] [Scenario](- "c:example" ) | [testVal](- "#testVal") | [Result](- "?=#result") |
| ----------------------------------- | ---------------------- | --------------------- |
| 1 scenario1 | 123 | pass |
| 2 scenario2 | 234 | pass |

[run]: - "#result=doSomething(#testVal)"

**And** if we do something else...


| [run][] [Scenario](- "c:example" ) | [testVal2](- "#testVal2") | [Result](- "?=#result") |
| ----------------------------------- | ---------------------- | --------------------- |
| 1 scenario3 | 123 | pass |
| 2 scenario4 | 234 | pass |

[run]: - "#result=doSomethingElse(#testVal2)"
__________________________________________________________

I was assuming it would print
  • printing message before Suite
    • printing message before Specification
      • printing message before Example
      • printing message after Example
    • printing message after Specification
  • printing message after Suite
But instead it printed:
  • printing message before Suite
  • printing message after Suite
    • printing message before Specification
      • printing message before Example
      • printing message after Example
    • printing message after Specification
(I added indention to aid in understanding of what parts contain other parts)

Can anyone please explain:
  1. Why the AfterSuite message is printed before the spec message instead of at the end?
  2. Why are there not 2 sets of example hooks fired (since there are 2 example tables?)
  3. Why a test that doesn't use the run command (e.g. manually running MyExampleTest1) prints the BeforeExample and AfterExample hooks but not the Specification hooks? 
Thanks for your patience - it would be great to get clarity on this, and maybe it can help the documentation if it isnt clear enough?

Cheers

Andy

Andy Dingfelder

unread,
Nov 15, 2018, 11:12:57 PM11/15/18
to concordion
 OK - a bit of a correction - one of my tests was failing so some of the hooks were not firing. that explains # 2 above.  I'll do some more debugging for #3

So at this point, the big mystery for me is # 1 above 
  • Why the AfterSuite message is printed before the spec and example messages (instead of at the end)?

Nigel Charman

unread,
Nov 21, 2018, 3:03:12 AM11/21/18
to conco...@googlegroups.com
Yes, that looks like an issue. Would you raise a Github issue please, attaching a test case that displays the issue? Thanks.
--
You received this message because you are subscribed to the Google Groups "concordion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to concordion+...@googlegroups.com.
To post to this group, send email to conco...@googlegroups.com.
Visit this group at https://groups.google.com/group/concordion.
To view this discussion on the web, visit https://groups.google.com/d/msgid/concordion/d22c3af8-e963-4243-adcd-61dee336a514%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages