Skip to content

Commit

Permalink
parte de testes
Browse files Browse the repository at this point in the history
  • Loading branch information
Alvaro committed Jul 27, 2014
1 parent 1f540b7 commit e913f21
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 15 deletions.
5 changes: 2 additions & 3 deletions test/cucumber/Member.feature
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,10 @@ Feature: member
Then I see my "name" and a link to logout

Scenario: administrator click on the roll of member and access the member profile
Given I am at the member List page
Given I am at the member List page and there is "number" members to order by name
When I move the mouse hover the rows and click to select the member
Then the administrator access the member profile

#Scenario: When the system try to retrieve the member list and is empty
#Given System access the


#end
44 changes: 42 additions & 2 deletions test/cucumber/steps/MemberSteps.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ When(~'^I create the member with username "([^"]*)"$') { String username ->
MemberTestDataAndOperations.createMember(username, "")
}


Then(~'^the member "([^"]*)" is not registered$') { String username ->
users = User.findAllByUsername(username);
assert users.size() == 1
Expand Down Expand Up @@ -193,12 +194,45 @@ When(~'^I try to create the member "([^"]*)" with email "([^"]*)"$') { String na
//#if ($memberListAndPageImprovement)

Given(~'^the administrator logs at system and there is "([^"]*)" of new not approved members$'){ int numberOfMembers ->
MemberTestDataAndOperations.orderNewMembersFirst(number)
MemberTestDataAndOperations.orderNewMembersFirst(numberOfMembers)

}

When(~'^I can click the attribute name of "([^"]*)" member$'){ int numberOfMembers ->
MemberTestDataAndOperations.orderMembers(numberOfMembers,"name")

}

Then(~'^the system will display the list of "number" members'){

}


Given(~'^I am at the member List page and there is "([^"]*)" members to order by name"$'){ int number, String attribute ->
MemberTestDataAndOperations.orderMembers(number,attribute)
MemberTestDataAndOperations.orderMembers(number,"name")
}

When(~'^I am at the member List page$'){


}

Then(~'^I see the "([^"]*)"new and the not approved members'){ int number ->
MemberTestDataAndOperations.orderNewMembersFirst(number)
}

Given(~'^The system has any member with username "([^"]*)"$') { String username ->
user = User.findByUsername(username);
member = user?.author
login();
}
When(~'^I am at any pager$'){ ->
to RegisterPage
at RegisterPage
}

Then(~'^I see my "([^"]*)" and a link to logout'){ String name ->
assert page.compareMemberName(name);
}

Given(~'^the system has no member with username "([^"]*)"$') { String username ->
Expand All @@ -210,7 +244,13 @@ Given(~'^the system has no member with username "([^"]*)"$') { String username -
assert ok== true
}

When(~'^I move the mouse hover the rows and click to select the member$'){

}

Then(~'^the administrator access the member profile'){

}


//#end
4 changes: 4 additions & 0 deletions test/functional/pages/RegisterPage.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,8 @@ class RegisterPage extends Page {
def compareMemberUniversity(String university){
$("form").university ==~ /${university}/
}

def compareMemberName(String name){
$("form").name ==~ /${name}/
}
}
1 change: 1 addition & 0 deletions test/functional/pages/member/MemberCreatePage.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,6 @@ class MemberCreatePage extends Page {
def compareMemberCity(String city){
$("form").city ==~ /${city}/
}

}

19 changes: 9 additions & 10 deletions test/functional/steps/MemberTestDataAndOperations.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ class MemberTestDataAndOperations {

//TODO member não tem username!
static members = [
[name: "Rodolfo", username: "usernametest", email: "[email protected]",
[name: "Rodolfo", email: "[email protected]",
status: "Graduate Student", university: "UFPE", enabled: true
],
[name: "Rebeca Souza", username: "rebecasouza", email: "[email protected]",
[name: "Rebeca Souza", email: "[email protected]",
status: "Graduate Student", university: "UFPE", enabled: true
],
[name: "Rubens Lopes", username: "rlfs", email: "[email protected]",
Expand All @@ -28,21 +28,20 @@ class MemberTestDataAndOperations {
//#if ($memberListAndPageImprovement)

static newMembers = [
[name: "Rodolfo", username: "newUser1", email: "[email protected]",
[name: "Rodolfo", email: "[email protected]",
status: "Graduate Student", university: "UFPE", enabled: false
],
[name: "Rebeca Souza", username: "newUser2", email: "[email protected]",
[name: "Rebeca Souza", email: "[email protected]",
status: "Graduate Student", university: "UFPE", enabled: false
],
[name: "Rubens Lopes", username: "newUser3", email: "[email protected]",
[name: "Rubens Lopes", email: "[email protected]",
status: "Graduate Student", university: "UFPE", enabled: false
],
[name: "Alvaro Joao", username: "ajsss", email: "[email protected]",
status: "Graduate Student", university: "UFPE", enabled: true
[name: "Alvaro Joao", email: "[email protected]",
status: "Graduate Student", university: "UFPE", enabled: false
]
]


static public def sendEmailToMember(String username) {
Member.sendEmail()
}
Expand All @@ -66,9 +65,9 @@ class MemberTestDataAndOperations {

//#end

static public def findByUsername(String username) {
static public def findByEmail(String email) {
members.find { member ->
member.username == username
member.email == email
}
}

Expand Down
21 changes: 21 additions & 0 deletions test/unit/rgms/HomeControllerSpec.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package rgms

import grails.test.mixin.TestFor
import rgms.home.HomeController
import spock.lang.Specification

/**
* See the API for {@link grails.test.mixin.web.ControllerUnitTestMixin} for usage instructions
*/
@TestFor(HomeController)
class HomeControllerSpec extends Specification {

def setup() {
}

def cleanup() {
}

void "test something"() {
}
}

0 comments on commit e913f21

Please sign in to comment.