Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.

added test-cases for adding comment #83

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class ArticleManagementTest extends Specification {
def 'article title positive cases'() {
given: 'user is created and logged in'
when: "user creates an article with $caseName"
then: 'article should not get created'
then: 'article should get created'
where:
caseName | articleTitle | messageIfCaseFailed
'Min boundary' | randomAlphabetic(1) | 'Could not create article with min title boundary'
Expand All @@ -33,7 +33,7 @@ class ArticleManagementTest extends Specification {
Users.signIn();
when: "user creates an article with $caseName"
Article article = Articles.create(new Article(content: articleContent))
then: 'article should not get created'
then: 'article should get created'
Articles.assertArticleExists(article, messageIfCaseFailed)
where:
caseName | articleContent | messageIfCaseFailed
Expand Down Expand Up @@ -105,5 +105,30 @@ class ArticleManagementTest extends Specification {
'second' | $randomLanguage | 'Could not create second translation of article'
'same language' | 'English' | 'Could not create translation of article on same language'
}

def 'comment adding positive cases'() {
given: 'user is created and logged in'
and: 'article is created and opened'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pay attention to formatting

when: "user creates a comment with $caseName"
then: 'comment should be added'
where:
caseName | commentLength | messageIfCaseFailed
'Min boundary' | randomAlphabetic(1) | 'Could not create comment with min length boundary'
'Max boundary' | randomAlphabetic(65535) | 'Could not create comment with max length boundary'
'Average length'| randomAlphabetic(3000) | 'Could not create comment of average length'
}

def 'comment adding negative cases'() {
given: 'user is created and logged in'
and: 'article is created and opened'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here.

when: "user creates a comment with $caseName"
then: 'validation error should be shown'
where:
caseName | commentLength | messageIfCaseFailed
'Empty comment' | '' | 'Empty comment was possible to create while this is not allowed''
'Too long comment' | randomAlphabetic(65536) | 'It was possible to create a comment with too long length'
'Spaces in comment'| ' ' | 'Comment with only spaces should not be allowed!'
}


}