spockframework / spockframework/spock

Interactions: unusable junit report in case methods where specified via variables

Open
#379 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Module-Core Type-Defect
Dominant language
Java
Stars
3.6k
Forks
483
PR merge metrics
No merged PRs in 30d

Description

Originally reported on Google Code with ID 257

What steps will reproduce the problem? If possible, provide source code and
stack trace.

Assuming the following interactions is specified:

   List methods = ['method_a', 'method_b', 'method_c']

   then:
   for(String method in methods)
     1 * someMock."${method}"(_)

The junit report would look like:

   junit.framework.AssertionFailedError: Too few invocations for:

   1 * someMock."${method}"(_) (0 invocations)
   1 * someMock."${method}"(_) (0 invocations)
   1 * someMock."${method}"(_) (0 invocations)

But I would expect that the report looks like:

   junit.framework.AssertionFailedError: Too few invocations for:

   1 * someMock.method_a(_) (0 invocations)
   1 * someMock.method_b(_) (0 invocations)
   1 * someMock.method_c(_) (0 invocations)

What version of Spock and Groovy are you using?
Spock version: 0.6
Groovy version: 1.7

Please provide any additional information below. You can also assign
labels.

See also discussion in forum https://groups.google.com/forum/#!topic/spockframework/tC4nLfFv8cY


Reported by markus_ketterer@gmx.de on 2012-06-19 11:39:59

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the interaction example using Spock 0.6 and Groovy 1.7, comparing the current JUnit failure report with the expected method names. Trace the interaction reporting or rendering path responsible for the failure message. Done means variable-based interactions are reported with method_a, method_b, and method_c rather than the unevaluated expression.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy, java
Domain
testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.