spockframework / spockframework/spock

Make spock.lang.Specification a Groovy trait

Open
#511 4 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Originally reported on Google Code with ID 389

Describe the enhancement you have in mind.

Would it be possible to implement Specification as a Groovy trait instead of an abstract
class?  (The abstract class could be part of a separate release to maintain support
for versions of Groovy prior to 2.3).


Which particular problem would this enhancement solve for you?

I do a lot of work with Apache Camel, which requires all tests to extend the CamelTestSupport
class.  Since Spock requires extending from Specification, I am unable to write my
Camel tests using Spock.  And I think there are other projects that also expose test
functionality via an abstract class that all tests must extend.

If Specification was a Groovy trait instead of an abstract class, then I could do this
to write a spec for testing camel:

class MyCamelSpec extends CamelTestSupport implements Specification {...}


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

Reported by mmindenhall on 2015-02-20 08:01:29

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

Start by locating spock.lang.Specification and reviewing how it currently serves as the base for Spock specifications. Check the compatibility implications of making it a Groovy trait, including the requested support for projects whose tests must extend another abstract class; done means such classes can implement Specification while existing supported Groovy versions remain addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.