spock Questions
0
trying to write some integration test with Spock framework for my controller that has @PreAuthorize annotation on it. When I run the app, this tag is working like a charm. However, when I run integ...
South asked 28/3, 2017 at 15:20
4
Solved
We combine Spock tests with Spring's @ContextConfiguration so we can build beans in a spring context and then use Spock for the actual testing. We would like to inject spock mocks into our spring b...
Emptyhanded asked 29/5, 2013 at 9:48
2
Solved
I try to embed groovy test to java project.
I start with spock examples - https://github.com/spockframework/spock-example
Examples is compile and execute by running maven goal test but if i try to...
Madalena asked 1/7, 2015 at 14:36
0
I have implemented Spock Integration test TestControllerIntegrationSpec on Grails, Groovy,GROM and Mongodb environment and the Test case has been passed when only one Interation test class availabl...
Posting asked 13/2, 2017 at 14:23
1
I have a multi-language project with tests implemented using Java (JUnit) and Groovy (Spock).
plugins {
id "org.sonarqube" version "2.2.1"
}
apply plugin: 'idea'
apply plugin: 'java'
apply plugi...
1
Solved
I use spock to write test case and jenkins to run and publish my test cases.
I was able to get the code coverage reported but sonar shows me only Java Unit test cases; the groovy test cases are tot...
6
Solved
For the ongoing projects and for improving our development process we considered adopting TDD as development philosophy. While researching for best practices and how to "sell" the new approac...
Masseuse asked 16/4, 2013 at 11:42
2
Solved
We've upgraded our app from Grails 2.4.4 to 2.5.0. All are working fine, but some test cases are failing which containing some private methods.
import org.junit.Before
class UserServiceSpec exten...
1
I have a question about validating arguments in a mock call with a closure. Sometimes I do this:
customerRepository.save({ Customer customer ->
assert ...
assert ...
}) >> { ... some r...
Endothecium asked 16/8, 2016 at 7:11
3
Solved
I having a method in command class, which use messageSource.getMessage(...), as messageSource won't get injected into the commandClass. I use
def messageSource = Holders.applicationContext.getBean...
1
Solved
How to do the equivalent of Mockito's deep mock / stub (RETURNS_DEEP_STUBS ) in Spock? Something like:
Changes changes = Mock()
changes.id(_).current() >> aChangeApi
While in Mockito it'd ...
3
Solved
I'm writing a Grails 2.2.1 integration test using the Spock plugin, in which I am trying to post two sets of data to the same controller endpoint:
when: "The user adds this product to the inventor...
Oddity asked 12/9, 2013 at 11:22
2
Solved
I have written a spock test where I'm trying to make assertions on a list of items. Let's say as an example I want to check every number in a list if it is equal to 500:
def numbers = [1,2,3,4]
nu...
1
Solved
The subject
I have some code that is decidedly not thread safe:
public class ExampleLoader
{
private List<String> strings;
protected List<String> loadStrings()
{
return Arrays.as...
Grundyism asked 17/9, 2016 at 23:35
2
I seem to be running into a tricky situation with ordering in one of my integration tests. I have a REST server based on Spring Boot/Spring MVC and a Cassandra DB. I'm using the spring-data-cassand...
Vicenary asked 21/11, 2015 at 5:48
2
Solved
package com.example.dev;
public class AClass {
private Integer a =10;
...//other code
}
and when I try to access a in my Spock method:
package com.example.dev;
def 'test a'() {
AClass aClassVa...
Frodin asked 20/10, 2014 at 11:49
3
I am writing functional tests and dealing with a modal window that fades in and out.
What is the difference between displayed and present?
For example I have:
settingsModule.container.displayed ...
Reims asked 23/8, 2012 at 18:55
2
I used @Stepwise for automation. 8 test methods are running sequentially to complete the process. One of the methods take parameter and I want to pass different parameters to the method.
But the ...
2
Does spock has any Test event listener like how TestNg has ITestListener. ?
So that I can have access, when the test cases failed etc.
Senator asked 22/9, 2014 at 5:34
3
Solved
I'm trying to fix our messy failing test runs, and, unfortunately, I'm very new to gradle. We currently have testng, junit, and I'd like to add some spock tests to the mix as well. I'm not quite su...
1
Solved
I just moved to Spring Boot 1.4.0 to use the new test features. However, I seem to be unable to use them in conjunction with the Spock Framework. Consider the following Spec:
@SpringBootTest(class...
Woodchopper asked 4/8, 2016 at 10:4
3
Solved
I am using Spock framework for testing (1.0-groovy-2.4 release). Junit offers this option to run a specific test using the command line (with Maven):
mvn -Dtest=TestCircle#mytest test
Question: ...
Pouliot asked 27/1, 2016 at 8:7
1
The spock documentation points out that you can extract assertions of then block to other method and add assert keyword before each assertion.
I would also like to extract interactions to helper ...
1
Solved
Although this question was already answered, still I'm not clear which one should I use during mocking
While referring to spock.lang.MockingApi.java. I couldn't able to catch any difference betwe...
Megillah asked 12/5, 2016 at 0:29
1
Solved
I am trying to write a Spock specification, where I want to verify a method that is being called with three arguments. I don't care about the first two at all, any instance of the argument types wo...
© 2022 - 2024 — McMap. All rights reserved.