Author: wsmoak Date: Mon Jun 15 16:22:07 2009 New Revision: 784844 URL: http://svn.apache.org/viewvc?rev=784844&view=rev Log: Clean up test class and add timing for the login step. Modified: continuum/sandbox/continuum-webapp-test-many-roles/src/test/java/org/apache/continuum/web/test/SlowLoginWithManyRolesTest.java Modified: continuum/sandbox/continuum-webapp-test-many-roles/src/test/java/org/apache/continuum/web/test/SlowLoginWithManyRolesTest.java URL: http://svn.apache.org/viewvc/continuum/sandbox/continuum-webapp-test-many-roles/src/test/java/org/apache/continuum/web/test/SlowLoginWithManyRolesTest.java?rev=784844&r1=784843&r2=784844&view=diff ============================================================================== --- continuum/sandbox/continuum-webapp-test-many-roles/src/test/java/org/apache/continuum/web/test/SlowLoginWithManyRolesTest.java (original) +++ continuum/sandbox/continuum-webapp-test-many-roles/src/test/java/org/apache/continuum/web/test/SlowLoginWithManyRolesTest.java Mon Jun 15 16:22:07 2009 @@ -1,7 +1,5 @@ package org.apache.continuum.web.test; -import org.testng.annotations.Test; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -25,28 +23,16 @@ * Test for slow login when there are many roles */ -import org.testng.Assert; -import org.testng.annotations.AfterTest; -import org.testng.annotations.BeforeSuite; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.Test; import com.thoughtworks.selenium.SeleneseTestCase; -import java.util.regex.Pattern; import java.util.Date; - -/** - * Based on AboutTest of Wendy Smoak test. - * - * @author JosŽ Morales Mart’nez - * @version $Id$ - */ +import org.testng.annotations.Test; @Test public class SlowLoginWithManyRolesTest extends SeleneseTestCase { public void setUp() throws Exception { - setUp("http://localhost:9090/", "*chrome"); + setUp("http://localhost:9080/", "*chrome"); } public void testNew() throws Exception { @@ -54,7 +40,7 @@ long begin, end; // Add the admin user - selenium.open("/security/addadmin.action"); + selenium.open("/continuum/security/addadmin.action"); selenium.type("adminCreateForm_user_fullName", "Administrator"); selenium.type("adminCreateForm_user_email", "admin@example.com"); selenium.type("adminCreateForm_user_password", "admin123"); @@ -66,18 +52,8 @@ selenium.click("configuration_"); selenium.waitForPageToLoad("30000"); - //Add a project group - selenium.click("link=Show Project Groups"); - selenium.waitForPageToLoad("30000"); - selenium.click("addProjectGroup"); - selenium.waitForPageToLoad("30000"); - selenium.type("addProjectGroup_name", "group1"); - selenium.type("addProjectGroup_groupId", "group1"); - selenium.click("addProjectGroup_"); - selenium.waitForPageToLoad("30000"); - //Add many project groups - for( int x = 2; x < 400; x++) { + for( int x = 1; x < 400; x++) { selenium.click("link=Show Project Groups"); selenium.waitForPageToLoad("30000"); selenium.click("addProjectGroup"); @@ -104,15 +80,11 @@ selenium.type("userCreateForm_user_password", "user1"); selenium.type("userCreateForm_user_password", "user123"); selenium.type("userCreateForm_user_confirmPassword", "user123"); - begin = new Date().getTime(); selenium.click("userCreateForm_0"); selenium.waitForPageToLoad("30000"); selenium.click("//input[@name='addDSelectedRoles' and @value='Project Developer - group1']"); selenium.click("addRolesToUser_submitRolesButton"); selenium.waitForPageToLoad("30000"); - end = new Date().getTime(); - - System.out.println( "===== It took " + (end-begin) + " to log in."); // User should not have to change its password on login selenium.click("link=user1"); @@ -120,7 +92,7 @@ selenium.click("userEditForm_user_passwordChangeRequired"); selenium.click("userEditForm__submit"); selenium.waitForPageToLoad("30000"); - selenium.open("/configuration!save.action"); + selenium.open("/continuum/configuration!save.action"); // Log out selenium.click("link=Logout"); @@ -131,12 +103,12 @@ selenium.waitForPageToLoad("30000"); selenium.type("loginForm_username", "user1"); selenium.type("loginForm_password", "user123"); + begin = new Date().getTime(); selenium.click("loginForm__login"); selenium.waitForPageToLoad("30000"); + end = new Date().getTime(); - - // TODO: Need to time the login step - + System.out.println( "===== It took " + (end-begin) + " to log in as user1"); selenium.click("link=Logout"); selenium.waitForPageToLoad("30000");