Background or combining tests

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Background or combining tests

Luis Trigueiros
Hi,

First I would like to express gratitude about how great Spock is and to say I am beginning to fell like I have testing super powers with Spock, :-).
How can we model test with Spock that are like a composition of test or have a background scenario.
So what I am looking to do is model in a test the following:
  1. Access an HTTP API and pull some data, and this is one test
  2. With the data that I pulled I should be able to perform some additional tests and assertions, and this is another test
I would like to:
  1. I would like the second test to use the first test data
  2. To be able to run the second test alone
  3. To be able to run the full test suite and don't run the first test twice.
  4. To run the second test alone and this test discover that needs to run test one first
Thank you kindly, Oscar

--
You received this message because you are subscribed to the Google Groups "Spock Framework - User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Background or combining tests

Peter Niederwieser
Administrator
Check out @Stepwise.

Sent from my iPhone

On 26 May 2015, at 13:14, Luis Trigueiros <[hidden email]> wrote:

Hi,

First I would like to express gratitude about how great Spock is and to say I am beginning to fell like I have testing super powers with Spock, :-).
How can we model test with Spock that are like a composition of test or have a background scenario.
So what I am looking to do is model in a test the following:
  1. Access an HTTP API and pull some data, and this is one test
  2. With the data that I pulled I should be able to perform some additional tests and assertions, and this is another test
I would like to:
  1. I would like the second test to use the first test data
  2. To be able to run the second test alone
  3. To be able to run the full test suite and don't run the first test twice.
  4. To run the second test alone and this test discover that needs to run test one first
Thank you kindly, Oscar

--
You received this message because you are subscribed to the Google Groups "Spock Framework - User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Spock Framework - User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Background or combining tests

Luis Trigueiros
Hi had look at the docs for @Setpwise but what I have currently are separated Specification classes in other words my test methods are not all in the same specification test class.
So for example I have one test to see that I can get products from a catalog, another test to make sure that I can buy a product from the catalog and another test that I can make a cancelation of a previous buy.
Thank you,
 Oscar

--
You received this message because you are subscribed to the Google Groups "Spock Framework - User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Background or combining tests

Kostis Kapelonis
The Spock runner is compatible with the JUnit runner. You should be
able to  group all your tests in a TestSuite (like you would do with
JUnit) and define the order even among different Specifications.



On Thu, Jun 4, 2015 at 2:27 AM, Luis Trigueiros
<[hidden email]> wrote:

> Hi had look at the docs for @Setpwise but what I have currently are separated Specification classes in other words my test methods are not all in the same specification test class.
> So for example I have one test to see that I can get products from a catalog, another test to make sure that I can buy a product from the catalog and another test that I can make a cancelation of a previous buy.
> Thank you,
>  Oscar
>
> --
> You received this message because you are subscribed to the Google Groups "Spock Framework - User" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> To post to this group, send email to [hidden email].
> Visit this group at http://groups.google.com/group/spockframework.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Spock Framework - User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.
Loading...