spock Questions

2

Solved

I'm having difficulties in understanding the @Unroll annotation of Spock's testing framework. In the docs, it is mentioned Indicates that iterations of a data-driven feature should be made visib...
Jaquelin asked 21/5, 2018 at 7:51

2

Solved

I just found out that when using spock you can mock all spring stereotypes ("Component", "Service" and "Controller") except of "Repository". What is the reason? Example: The following example doe...
Cleek asked 9/1, 2018 at 15:13

1

My android app is multi module project: include (android-app/kotlin-android)':application', (pure kotlin)':presentation', (pure kotlin)':domain', (android-library/kotin-android)':dataproviders' ...
Baxie asked 11/7, 2017 at 14:35

2

Solved

In Grails 3.1.12, I want to unit test a service: @Transactional class PlanService { List<Plan> getPlans(Map params) { def currentUser = (User)springSecurityService.getCurrentUser() return...
Lens asked 3/10, 2016 at 12:12

1

Im using Spock for my tests and I have multiple classes to test. I want to tell Spock to test each class in specific order. Is there a way to do this? I noticed TestNG has got @AfterTest annotation...
Donegal asked 26/2, 2018 at 10:17

3

Solved

Given this entry in application.properties: server.port=0 which causes Spring Boot to chose a random available port, and testing a spring boot web application using spock, how can the spock code...
Tremulous asked 9/7, 2014 at 0:9

3

Can I take a test like this and extract the where clause data table into a reusable block? @Unroll void "test that doSomething with #a and #b does not fail"(String a, String b) { when: doSomethi...
Dentate asked 10/10, 2017 at 13:3

4

Solved

I have been trying to create a Groovy project with Spock testing in IntelliJ IDEA. Here are steps that I followed: Created Groovy project and added Maven support. Added Spock dependencies and pl...
Yeld asked 27/1, 2014 at 19:28

6

Solved

I'm trying to use the grails spock plugin with 1.3.7. I can run tests from the terminal via grails test-app :spock, but when I try to run ControllerSpec tests from within Intelli-J, I get unable to...
Chromoplast asked 30/3, 2012 at 14:50

1

Solved

I just wanted to know how I can test the output from a groovy function that does a println of some stuff. So the stupid class I wrote is: class FriendlyGreeterLib { def greet(name) { println "${...
Ace asked 20/11, 2017 at 15:51

1

I updated Android Studio to version 3 and since then all my spock tests, when in a java module, do not run when trying to run them from inside the application (right click on groovy folder -> Run '...
Secession asked 26/10, 2017 at 13:31

2

Solved

I am working on spring boot application. I have to write test cases for it. I haven't written test cases before, so someone suggested using spock framework for it. I explored spock and i thin...
Humpback asked 17/6, 2015 at 8:3

2

Given an method with a parameter in Java, e.g. public class Foo { public Bar theBar(Bar bar) { /*... */ } } When stubbing/ mocking foo, how do I tell it to accept any argument and return it? (...
Digged asked 6/10, 2017 at 14:16

2

Solved

I have such Application class: @Configuration @EnableAutoConfiguration @ComponentScan @ImportResource("classpath:applicationContext.xml") @EnableJpaRepositories("ibd.jpa") publi...
Storey asked 15/6, 2015 at 9:33

2

Lately I've been trying to run my spock tests in IntelliJ (which used to work beautifully and had great debugging / specific test re-running on failure features) and in the past few months I've beg...
Systematism asked 7/1, 2014 at 16:24

5

I'd like to be able to log the spock feature names and clause labels when running some automated tests. This would help with debugging test issues when using a headless browser for automation, spec...
Intuitionism asked 1/7, 2016 at 12:40

2

Solved

I am using Eclipse for a Java project with some tests written in Groovy / Spock which uses the given: when: then: syntax. I would like these keywords to highlighted with some colour. Note: the spoc...
Unbelieving asked 14/7, 2017 at 12:26

1

Solved

I've recently found Karate framework for testing Web Services. But there is also Spock framework providing similar (to my mind) functionality. What are the differences between the frameworks? I wou...
Ardellaardelle asked 27/7, 2017 at 13:33

0

I want to test protected endpoints in my application and I would like login before each test, get token and use this token in next tests. @ContextConfiguration @SpringBootTest(webEnvironment = Spr...
Pinelli asked 17/7, 2017 at 11:15

2

Solved

I have a test where I want to test a specific result to be of a kind of a class. Asserting this with the instanceof keyword. Sadly I did not figured out how to actually provide a data value expecte...
Boxthorn asked 24/6, 2017 at 19:9

4

Solved

What is the best way to run an integration test (e.g., @IntegrationTest) with Spock? I would like to bootstrap the whole Spring Boot application and execute some HTTP calls to test the whole functi...
Hengelo asked 25/6, 2014 at 10:4

3

I try to run my first Spock Test inside Eclipse, and it does not work. I added all the Maven dependencies and plugins in my pom.xml, but when I run my test with jUnit, there is a popup windows wi...
Fluorosis asked 2/5, 2012 at 13:52

2

Solved

In JUnit 3, I could get the name of the currently running test like this: public class MyTest extends TestCase { public void testSomething() { assertThat(getName(), is("testSomething")); } } ...
Carpel asked 3/12, 2011 at 4:16

2

Solved

I am writing a test script using spock, geb, and WebDriver. The script submits a form on an insecure page. The page submits to a secure HTTPS URL. Firefox shows a warning for this, specifcally: ...
Whimper asked 22/8, 2012 at 22:2

2

Solved

I am writing a library to provide some functionality that is shared between multiple different Spring Boot applications that I work with. I would like to do something similar to the auto-configura...
Christos asked 28/3, 2017 at 19:19

© 2022 - 2024 — McMap. All rights reserved.