From ce7d6a1f21c076ffe352bc875d601b4702cc3aa4 Mon Sep 17 00:00:00 2001 From: Andrei Punko Date: Wed, 6 Nov 2024 18:01:16 +0300 Subject: [PATCH] Func-tests cleanup: build script, text messages in tests --- func-test/build.gradle | 17 +++++++++-------- .../by/andd3dfx/configs/Configuration.groovy | 1 - .../groovy/by/andd3dfx/specs/SomeSpec.groovy | 10 +++++----- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/func-test/build.gradle b/func-test/build.gradle index 605fa87..55b13f1 100644 --- a/func-test/build.gradle +++ b/func-test/build.gradle @@ -6,7 +6,9 @@ plugins { group 'by.andd3dfx' version '0.1' -sourceCompatibility = 21 +java { + sourceCompatibility = JavaVersion.VERSION_21 +} repositories { mavenLocal() @@ -15,15 +17,14 @@ repositories { dependencies { implementation 'org.codehaus.groovy:groovy-all:2.5.23' - testImplementation group: 'junit', name: 'junit', version: '4.13.2' testImplementation 'com.athaydes:spock-reports:1.7.1', { transitive = false } + implementation 'org.codehaus.groovy.modules.http-builder:http-builder:0.7.1' + testImplementation 'org.spockframework:spock-core:1.3-groovy-2.5' + testImplementation 'org.spockframework:spock-spring:1.3-groovy-2.5' + testImplementation 'org.springframework.boot:spring-boot-starter-test:3.3.5' + implementation 'commons-io:commons-io:2.14.0' + implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.4.2' - implementation group: 'org.codehaus.groovy.modules.http-builder', name: 'http-builder', version: '0.7.1' - testImplementation group: 'org.spockframework', name: 'spock-core', version: '1.3-groovy-2.5' - testImplementation group: 'org.spockframework', name: 'spock-spring', version: '1.3-groovy-2.5' - testImplementation "org.springframework.boot:spring-boot-starter-test:2.2.5.RELEASE" - implementation group: 'commons-io', name: 'commons-io', version: '2.8.0' - implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.9.8' } test { diff --git a/func-test/src/test/groovy/by/andd3dfx/configs/Configuration.groovy b/func-test/src/test/groovy/by/andd3dfx/configs/Configuration.groovy index 4aa4384..f38a88e 100644 --- a/func-test/src/test/groovy/by/andd3dfx/configs/Configuration.groovy +++ b/func-test/src/test/groovy/by/andd3dfx/configs/Configuration.groovy @@ -1,6 +1,5 @@ package by.andd3dfx.configs - import groovyx.net.http.RESTClient class Configuration { diff --git a/func-test/src/test/groovy/by/andd3dfx/specs/SomeSpec.groovy b/func-test/src/test/groovy/by/andd3dfx/specs/SomeSpec.groovy index f929bde..8db3c4a 100644 --- a/func-test/src/test/groovy/by/andd3dfx/specs/SomeSpec.groovy +++ b/func-test/src/test/groovy/by/andd3dfx/specs/SomeSpec.groovy @@ -19,7 +19,7 @@ class SomeSpec extends Specification { } def 'Read particular author'() { - when: 'get particular author' + when: 'get particular author by id' def getResponse = restClient.get(path: '/api/v1/authors/' + authorId) then: 'server returns 200 code (ok)' @@ -53,7 +53,7 @@ class SomeSpec extends Specification { } def 'Read all articles using pagination'() { - when: 'get all articles' + when: 'get all articles for page=4, pageSize=2, sort by author.firstName,DESC' def getResponse = restClient.get( path: '/api/v1/articles', query: [size: '2', page: '4', sort: 'author.firstName,DESC'] @@ -66,7 +66,7 @@ class SomeSpec extends Specification { } def 'Read particular article'() { - when: 'get particular article' + when: 'get particular article by id' def getResponse = restClient.get(path: '/api/v1/articles/' + id) then: 'server returns 200 code (ok)' @@ -100,7 +100,7 @@ class SomeSpec extends Specification { assert createResponse.responseData.summary == 'Bla-bla summary' assert createResponse.responseData.text == 'BomBiBom' - cleanup: + cleanup: 'delete created article' restClient.delete(path: '/api/v1/articles/' + createResponse.responseData.id) } @@ -136,7 +136,7 @@ class SomeSpec extends Specification { } def 'Update an article'() { - when: 'update title of an article with id=2' + when: 'update article.title for article with id=2' def newTitle = generateRandomString(10) def updateResponse = restClient.patch( path: '/api/v1/articles/2',