spock Questions

2

Solved

We decided to give Spock a try as a testing framework for our java based EE application. Currently we have a CI infrastructure deployed based on jenkins + maven + jacoco. Q: the question is ...
Premillennial asked 8/5, 2013 at 11:6

2

Solved

I'm new to spock and noticed the setup: step in a specification is scoped local to that specific test. How might I share setup across these fixtures similar to the traditional junit approach? than...
Zigzagger asked 10/8, 2011 at 12:41

1

Solved

For simplicity let's take a very simple class: public class TestingClass { public void method1(){ System.out.println("Running method 1"); method2(); } public void method2(){ System.out.pri...
Gigigigli asked 4/3, 2015 at 23:33

4

Solved

I'd like to execute some action when Spock test fails. Specifically, take a screenshot. Is it possible? How to do it?
Dibranchiate asked 7/5, 2013 at 13:14

3

Solved

I'm trying to write an elegant Spock specification that will read a very large test data from CSV file without loading all the data into the memory. I'm looking for your feedback on how you might d...
Palace asked 7/8, 2014 at 18:15

2

Solved

I have a Spock test case where I want to load a Spring application. I have a very rudimentary Groovy class that is my config object: @Configuration @EnableAutoConfiguration class TestConfig { @Be...
Tsunami asked 11/8, 2014 at 23:18

4

Solved

I have a class that has the responsibility of importing contracts from a CSV to database. The class itself has only one public method that starts the import and the other methods are all pri...
Aigneis asked 15/1, 2015 at 17:56

1

Solved

I am using Traits for making my controllers DRY. I want to unit test the Trait class using Spock. Here is my sample trait and Spock test case respectively: trait SomeTrait { public void checkSome...
Hepplewhite asked 6/1, 2015 at 7:1

2

Solved

In one of the Spock tests I see a strange condition in then block: 0 * someInstance._ What does it mean?
Fossilize asked 10/12, 2014 at 7:41

1

Solved

I have a setup of a simple controller: @Controller @RequestMapping("/test") public class TestController { @RequestMapping(value = "/{id}", method = RequestMethod.GET, produces = MediaType.APPLIC...
Firebrand asked 5/12, 2014 at 3:52

2

I want to register a Listener to all spock geb specs in my grails-app so I added a IGlobalExtension to myapp/src/groovy package myapp.spock class TakeScreenshotExtension implements IGlobalExtensi...
Guardado asked 12/12, 2013 at 20:35

3

Solved

Hi I have a controller called ApiController which uses a service called ApiService like so: def createCategory(){ def jsonObj = request.JSON jsonObj.each{ key, value -> params.put(key,value)...
Tadich asked 11/11, 2014 at 10:40

1

Solved

Is it possible to mock out the return value of a method in spock based on the nth time it was called? Note that I don't want to specify the parameters passed in because it does not matter for a spe...
Prieto asked 4/11, 2014 at 14:12

0

I am new to Spring boot and while testing the REST endpoint using SPOCK , came across with the question #24405727 I have tried the exact configuration but getting the below exception java.lang.Ille...
Lyceum asked 30/10, 2014 at 13:51

3

Solved

I am using Spock for the first time. Since we are using a complex domain-model it would be handy to have a mechanism, which allows me to create full objects from data given by spock tables. I do no...
Newmark asked 2/10, 2014 at 7:57

1

Solved

I have a method that receives a ContactForm object and a map with recipients. So I wrote the following spec that the correct recipient from the Map is returned, based on the inquiry of the form: d...
Liggins asked 17/9, 2014 at 12:48

1

Solved

I have seen _._ in the source code of a few Spock Specs. Does anyone know what that means? For example, def "test something"() { given: someClass = Mock(SomeClass) and: 1 * someClass.someMet...
Gaddy asked 3/9, 2014 at 17:13

1

Solved

I'm using grails 2.4.2 and by default it already has spock installed right? Well, one of my controller tests isn't working quite right. I'm trying to mock several of my services, but I keep getting...
Introductory asked 16/8, 2014 at 8:6

0

I have a test where I need to make several calls back to back to test a controller using Grail's IntegrationSpec. when: "User starts a flow" controller.userSessionService.user = user controller...
Rostov asked 14/8, 2014 at 3:35

1

Solved

If we want to use for our test TestNG we have to write something like: dependencies { compile project(':model') testCompile 'org.testng:testng:6.8' } test.useTestNG() But when using Spock we ...
Courthouse asked 23/7, 2014 at 11:28

3

I have a problem executing JUnit Tests in parallel when Using JUnit, Groovy, Spock and Maven. When executing them, I get the following after test are passed succesfully: [INFO] -------------------...
Swadeshi asked 20/3, 2013 at 14:34

2

Solved

RunWith(PowerMockRunner.class) @PrepareForTest(StaticCallInvoke.class) @ContextConfiguration(locations = "file:test/spring/Beans.xml") class TestClass extends Specification{ @Test def "Testing sta...
Waller asked 22/10, 2013 at 5:33

3

Solved

org.spockframework:spock-core:0.7-groovy-2.0 Gradle 1.12 Groovy 1.8.6 java Hello, I am trying to use spock with my java application to run unit tests and building with gradle. However, since I ...
Ardelia asked 4/7, 2014 at 8:6

2

Solved

I'm trying to test some code that's in src/groovy using Spock. The code I'm testing references grailsApplication. Since it's in src/groovy, I used dependency injection to inject grailsApplication i...
Start asked 30/6, 2014 at 19:0

2

Solved

GNU Emacs 24.3.1 Gradle 1.12 spock-core.0.7 Hello, I am doing unit testing with spock framework using the gradle build system. When I run my tests gradle test I just see a message like this: *...
Newland asked 23/6, 2014 at 6:58

© 2022 - 2024 — McMap. All rights reserved.