Skip to content

Commit

Permalink
Func-tests cleanup: build script, text messages in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei-punko committed Nov 6, 2024
1 parent cdc2c2b commit ce7d6a1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
17 changes: 9 additions & 8 deletions func-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ plugins {
group 'by.andd3dfx'
version '0.1'

sourceCompatibility = 21
java {
sourceCompatibility = JavaVersion.VERSION_21
}

repositories {
mavenLocal()
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package by.andd3dfx.configs


import groovyx.net.http.RESTClient

class Configuration {
Expand Down
10 changes: 5 additions & 5 deletions func-test/src/test/groovy/by/andd3dfx/specs/SomeSpec.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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)'
Expand Down Expand Up @@ -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']
Expand All @@ -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)'
Expand Down Expand Up @@ -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)
}

Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit ce7d6a1

Please sign in to comment.