Skip to content

Commit

Permalink
Adicionando todos os testes e corrigindo as issues spgroup#249 e spgr…
Browse files Browse the repository at this point in the history
  • Loading branch information
Bruno Silva committed Jan 21, 2014
1 parent 4df5099 commit 40cfe23
Show file tree
Hide file tree
Showing 19 changed files with 996 additions and 173 deletions.
2 changes: 2 additions & 0 deletions grails-app/domain/rgms/member/Orientation.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ class Orientation {
String instituicao
String curso


static constraints = {
tipo(nullable: false, blank: false, inList: ["Mestrado","Doutorado","Iniciação Científica"])
orientando(nullable: false)
orientador(nullable: false)
tituloTese(nullable: false, blank: false, unique: true)
anoPublicacao(nullable: false, min: 0)
instituicao(nullable: false, blank: false)
curso(nullable: true)
}

boolean Equals(Orientation other)
Expand Down
33 changes: 17 additions & 16 deletions test/cucumber/Orientation.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ Feature: orientations
so that I can generate web pages and reports containing these orientations

Scenario: new orientation
Given the system has no orientations entitled "The Book of Software"
When I create a new orientation entitled "The Book of Software"
Then the orientation "The Book of Software" is properly stored by the system
Given the system has no orientations entitled "The Book is on the table"
When I create a new orientation entitled "The Book is on the table"
Then the orientation "The Book is on the table" is properly stored by the system

Scenario: remove existing orientation
Given the system has an orientation entitled "The Book is on the table" supervised for someone
Expand All @@ -17,21 +17,21 @@ Feature: orientations
Scenario: create orientation web
Given I am at the create orientation page
When I fill the orientation title with "The Book of Web Software"
Then I am on the orientation show page
Then the orientation "The Book of Web Software" is properly stored by the system

Scenario: edit existing orientation web
Given I am at the orientation page and the orientation "The Book of Software Engineering" is stored in the system
When I select to view orientation "The Book of Software Engineering" in resulting list
And I change the orientation tituloTese to "Hexa"
And I select the "Alterar" option
Then I am on the orientation show page
And I select the alterar option at orientation edit page
Then I am on the orientation show page with edition completed

#1
Scenario: new orientation with registered member orientated
Given the system has no orientations entitled "The Book is on the table 2"
And Exists a member with username "rlfs" that has been an registered member
When I create a orientation for the thesis "The Book is on the table 2" with registered member "rlfs"
Then the orientation "The Book is on the table 2" is properly stored by the system
#Scenario: new orientation with registered member orientated
# Given the system has no orientations entitled "The Book is on the table 2"
# And Exists a member "Rubens Lopes" with username "rlfs" that has been an registered member
#When I create a orientation for the thesis "The Book is on the table 2" with registered member "rlfs"
#Then the orientation "The Book is on the table 2" is properly stored by the system

#2
Scenario: duplicate orientation
Expand All @@ -51,7 +51,7 @@ Feature: orientations
When I select to view orientation "The Book is on the table" in resulting list
And I change the orientation tituloTese to "Hexa"
And I change the orientation anoPublicacao to -1
And I select the "Alterar" option
And I select the alterar option at orientation edit page
Then I am still on the change orientation page with the error message

#if ($XMLUpload)
Expand All @@ -68,8 +68,9 @@ Feature: orientations
And the orientations are not stored by the system
#end

#9 extra
Scenario: remove orientation web
Given I am at the orientation page and the orientation "Hexa" is stored in the system
When I select to view orientation "Hexa" in resulting list
And I select the "Remover" option
Then The orientation "Hexa" is properly removed by the system
Given I am at the orientation page and the orientation "Hexa2" is stored in the system
When I select to view "Hexa2" in the list of orientations
And I select the option remove at Orientation Show Page
Then The orientation "Hexa2" is properly removed by the system
18 changes: 9 additions & 9 deletions test/cucumber/Thesis.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
Feature: Thesis Tests
As a member of a research group
I want to add, remove and modify theses I have added

Scenario: new thesis duplicated
Given The thesis "Thesis duplicated" is stored in the system with file name "Thesisduplicated.txt"
When I create the thesis "Thesis duplicated" with file name "Thesisduplicated2.txt" and school "UFPE"
Then The thesis "Thesis duplicated" is not stored twice

Scenario: new thesis
Given The system has no thesis entitled "New thesis"
When I create the thesis "New thesis" with file name "Newthesis.txt" and school "UFPE"
Then The thesis "New thesis" is properly stored by the system

#6
Scenario: remove existing thesis
Given the system has thesis entitled "New thesis"
When I delete the thesis "New thesis"
Then the thesis "New thesis" is properly removed by the system
Given the system has thesis entitled "New thesis2"
When I delete the thesis "New thesis2"
Then the thesis "New thesis2" is properly removed by the system

Scenario: create thesis web
Given I am at the create thesis page
Expand All @@ -32,10 +32,10 @@ Feature: Thesis Tests

#7
Scenario: remove existing thesis web
Given I am at the thesis page and the thesis "Software Enginnering" is stored in the system
When I select to view thesis "Software Enginnering" in resulting list
And I select the "Remover" option on Thesis Show Page
Then the system show that the thesis has been removed
Given I am at the thesis page and the thesis "Software Enginnering2" is stored in the system
When I select to view thesis "Software Enginnering2" in resulting list
And I select the remover option on Thesis Show Page
Then the thesis "Software Enginnering2" has been removed from the system

#if ($contextualInformation)
Scenario: Add a new thesis with user data already filled by default
Expand Down
42 changes: 21 additions & 21 deletions test/cucumber/steps/BookChapterSteps.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ Then(~'^the book chapter "([^"]*)" is properly removed by the system$') { String
checkIfExists(title)
}

When(~'^I select the Novo BookChapter option at the book chapter page$') {->
When(~'^I select the Novo BookChapter option at the book chapter page$') { ->
at BookChapterPage
page.selectNewBookChapter()
}

Given(~'^I am at the book chapter page$') {->
Given(~'^I am at the book chapter page$') { ->
to LoginPage
at LoginPage
page.fillLoginData("admin", "adminadmin")
Expand All @@ -60,20 +60,20 @@ And(~'^I fill only the title field with the value "([^"]*)"$') { String title ->
page.fillTitle(title)
}

Then(~'^A failure message is displayed$') {->
assert ( page.readFlashMessage() != null )
Then(~'^A failure message is displayed$') { ->
assert (page.readFlashMessage() != null)

}
And(~'^I still on the book chapter create page$'){->
And(~'^I still on the book chapter create page$') { ->
at BookChapterCreatePage
}

Then(~'^I see my user listed as a member of book chapter by default$') {->
Then(~'^I see my user listed as a member of book chapter by default$') { ->
at BookChapterCreatePage
assert TestDataAndOperationsPublication.containsUser(page.selectedMembers())
}

When(~'^I view the book chapter list$') {->
When(~'^I view the book chapter list$') { ->
to BookChapterPage
}

Expand All @@ -82,7 +82,7 @@ Then(~'my book chapter list contains "([^"]*)"$') { String title ->
bookChapterList = BookChapter.findAll()
assert BookChapterTestDataAndOperations.containsBookChapter(title, bookChapterList)
}
And(~'^the book chapter "([^"]*)" with file name "([^"]*)" was created before$'){ String title, filename ->
And(~'^the book chapter "([^"]*)" with file name "([^"]*)" was created before$') { String title, filename ->
page.selectNewBookChapter()
to BookChapterCreatePage
at BookChapterCreatePage
Expand All @@ -95,30 +95,30 @@ Then(~'My resulting book chapter list contains "([^"]*)"$') { String title ->
at BookChapterPage
page.checkBookChapterAtList(title, 0)
}
When(~'^I go to NewBookChapter page$'){->
When(~'^I go to NewBookChapter page$') { ->
to BookChapterPage
at BookChapterPage
page.selectNewBookChapter()
at BookChapterCreatePage
}
And(~'^I use the webpage to create the book chapter "([^"]*)" with file name "([^"]*)"$'){ String title, filename ->
And(~'^I use the webpage to create the book chapter "([^"]*)" with file name "([^"]*)"$') { String title, filename ->
at BookChapterCreatePage
createAndCheckBookOnBrowser(title, filename)
to BookChapterPage
at BookChapterPage
}
Then(~'^the book chapter "([^"]*)" was stored by the system$'){String title ->
Then(~'^the book chapter "([^"]*)" was stored by the system$') { String title ->
book = BookChapter.findByTitle(title)
assert book != null
to BookChapterPage
at BookChapterPage
}
And(~'^it is shown in the book chapter list with title "([^"]*)"$'){ String title ->
And(~'^it is shown in the book chapter list with title "([^"]*)"$') { String title ->
to BookChapterPage
at BookChapterPage
page.checkBookChapterAtList(title, 0)
}
Given(~'^the system has some book chapters stored$') {->
Given(~'^the system has some book chapters stored$') { ->
initialSize = BookChapter.findAll().size()
}
When(~'^I upload the book chapters of "([^"]*)"$') { filename ->
Expand All @@ -128,7 +128,7 @@ When(~'^I upload the book chapters of "([^"]*)"$') { filename ->
finalSize = BookChapter.findAll().size()
assert initialSize < finalSize
}
Then(~'^the system has all the book chapters of the xml file$') {->
Then(~'^the system has all the book chapters of the xml file$') { ->
assert BookChapter.findByTitle("Refinement of Concurrent Object Oriented Programs") != null
assert BookChapter.findByTitle("A RUP-Based Software Process Supporting Progressive Implementation") != null
assert BookChapter.findByTitle("Transformation Laws for Sequential Object-Oriented Programming") != null
Expand All @@ -138,21 +138,21 @@ Then(~'^the system has all the book chapters of the xml file$') {->
}


And(~'^I select the upload button at the book chapter page$') {->
And(~'^I select the upload button at the book chapter page$') { ->
at BookChapterPage
page.uploadWithoutFile()
}
Then(~'^I\'m still on book chapter page$') {->
Then(~'^I\'m still on book chapter page$') { ->
at BookChapterPage
}
And(~'^the book chapters are not stored by the system$') {->
And(~'^the book chapters are not stored by the system$') { ->
at BookChapterPage
page.checkIfBookChapterListIsEmpty()
}

And(~'^the system has a book chapter entitled "([^"]*)" with file name "([^"]*)"$') { String title, String filename ->
book = BookChapter.findByPublisher(title)
if(book == null){
if (book == null) {
BookChapterTestDataAndOperations.createBookChapter(title, filename)
to BookChapterCreatePage
}
Expand All @@ -163,20 +163,20 @@ Then(~'^the book chapter "([^"]*)" was not stored twice$') { String entitled ->
assert bookChapter.size() < 2
}

And(~'^it is shown an message error$'){ ->
And(~'^it is shown an message error$') { ->
at BookChapterSavePage
assert page.readFlashMessage() != null
}


def createAndCheckBookOnBrowser(String title, String filename){
def createAndCheckBookOnBrowser(String title, String filename) {
page.fillBookChapterDetails(title, filename)
page.clickSaveBookChapter()
book = BookChapter.findByTitle(title)
assert book != null
}

def checkIfExists(String title){
def checkIfExists(String title) {
bookChapter = BookChapter.findByTitle(title)
assert bookChapter == null
}
26 changes: 13 additions & 13 deletions test/cucumber/steps/MemberSteps.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Then(~'^the system has no member with a username "([^"]*)"$') { String username
assert member == null
}

Given(~'^I am at the login page$') {->
Given(~'^I am at the login page$') { ->
to LoginPage
at LoginPage
//assert (page.flashmessage?.size() == 0)
Expand All @@ -46,12 +46,12 @@ When(~'^I fill username and password with "([^"]*)" and "([^"]*)"$') { String lo
page.fillLoginData(login, password)
}

Then(~'^I am still on the login page with an error message$') {->
Then(~'^I am still on the login page with an error message$') { ->
at LoginPage
assert page.readFlashMessage() != null
}

Given(~'^I am at the register page$') {->
Given(~'^I am at the register page$') { ->
to RegisterPage
at RegisterPage
}
Expand All @@ -61,7 +61,7 @@ When(~'^I fill the user details with a name, username, passoword1, password2, em
page.fillUserDetails(name, username, password1, password2, email, university, status)
}

Then(~'^I am still on the register page with the message user created$') {->
Then(~'^I am still on the register page with the message user created$') { ->
at RegisterPage
}

Expand Down Expand Up @@ -99,7 +99,7 @@ Then(~'^the member "([^"]*)" is not registered$') { String username ->
assert users.size() == 1
}

Given(~'^I am at the create member page$') {->
Given(~'^I am at the create member page$') { ->
to LoginPage
at LoginPage
page.fillLoginData("admin", "adminadmin")
Expand All @@ -115,7 +115,7 @@ When(~'^I fill some user details with "([^"]*)" "([^"]*)" "([^"]*)" "([^"]*)"$')
page.fillSomeMemberDetails(name, username, email, university)
}

Then(~'^I am on the member show page$') {->
Then(~'^I am on the member show page$') { ->
at MemberViewPage
}

Expand All @@ -129,7 +129,7 @@ Then(~'^I am on the member show page$') {->
page.fillMemberDetails(name, username, email, university)
}*/

Then(~'^I am still on the create member page with the error message$') {->
Then(~'^I am still on the create member page with the error message$') { ->
at MemberCreatePage
//assert mensagem != null

Expand All @@ -143,7 +143,7 @@ When(~'^I fill user details with "([^"]*)" "([^"]*)" "([^"]*)" "([^"]*)"$') { St
page.fillSomeMemberDetails(name, username, email, university)
}

When(~"^I view the member list\$") {->
When(~"^I view the member list\$") { ->
members = Member.findAll()
assert members != null
}
Expand All @@ -159,15 +159,15 @@ Then(~'the member with username "([^"]*)" is created$') { String username ->
assert member != null
}

Then(~'^I see default data filled on create form$'){ ->
Then(~'^I see default data filled on create form$') { ->
at MemberCreatePage
defaultUniversity = "Federal University of Pernambuco"
defaultCity = "Recife"
defaultUniversity = "Federal University of Pernambuco"
defaultCity = "Recife"
assert page.compareMemberUniversity(defaultUniversity) && page.compareMemberCity(defaultCity)
}

Then(~'^I see default data filled on register form$'){ ->
Then(~'^I see default data filled on register form$') { ->
at RegisterPage
defaultUniversity = "Federal University of Pernambuco"
defaultUniversity = "Federal University of Pernambuco"
assert page.compareMemberUniversity(defaultUniversity)
}
Loading

0 comments on commit 40cfe23

Please sign in to comment.