You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@continuum.apache.org by ct...@apache.org on 2009/11/10 06:38:03 UTC
svn commit: r834357 [3/7] - in
/continuum/branches/continuum-1.3.x/continuum-webapp-test: ./ src/site/
src/site/apt/ src/test/it/org/apache/continuum/web/test/
src/test/resources/ src/test/testng/config/
src/test/testng/org/apache/continuum/web/test/ s...
Modified: continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/AbstractContinuumTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/AbstractContinuumTest.java?rev=834357&r1=834356&r2=834357&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/AbstractContinuumTest.java (original)
+++ continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/AbstractContinuumTest.java Tue Nov 10 05:38:01 2009
@@ -1,1101 +0,0 @@
-package org.apache.continuum.web.test;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.testng.Assert;
-
-/**
- * Based on AbstractContinuumTestCase of Emmanuel Venisse test.
- *
- * @author José Morales MartÃnez
- * @version $Id$
- */
-public abstract class AbstractContinuumTest
- extends AbstractSeleniumTest
-{
-
- // ////////////////////////////////////
- // About
- // ////////////////////////////////////
- public void goToAboutPage()
- {
- clickLinkWithText( "About" );
-
- assertAboutPage();
- }
-
- public void assertAboutPage()
- {
- assertPage( "Continuum - About" );
- assertTextPresent( "About Continuum" );
- assertTextPresent( "Version:" );
- }
-
- // ////////////////////////////////////
- // Configuration
- // ////////////////////////////////////
- public void assertEditConfigurationPage()
- {
- assertPage( "Continuum - Configuration" );
- assertTextPresent( "Working Directory" );
- assertElementPresent( "workingDirectory" );
- assertTextPresent( "Build Output Directory" );
- assertElementPresent( "buildOutputDirectory" );
- assertTextPresent( "Deployment Repository Directory" );
- assertElementPresent( "deploymentRepositoryDirectory" );
- assertTextPresent( "Base URL" );
- assertElementPresent( "baseUrl" );
- }
-
- public void submitConfigurationPage( String baseUrl, String companyName, String companyLogo, String companyUrl )
- {
- setFieldValue( "baseUrl", baseUrl );
- if ( companyName != null )
- {
- setFieldValue( "companyName", companyName );
- }
- if ( companyLogo != null )
- {
- setFieldValue( "companyLogo", companyLogo );
- }
- if ( companyUrl != null )
- {
- setFieldValue( "companyUrl", companyUrl );
- }
- submit();
- waitPage();
- }
-
- // ////////////////////////////////////
- // ANT/SHELL Projects
- // ////////////////////////////////////
- public void assertAddProjectPage( String type )
- {
- String title = type.substring( 0, 1 ).toUpperCase() + type.substring( 1 ).toLowerCase();
- assertPage( "Continuum - Add " + title + " Project" );
- assertTextPresent( "Add " + title + " Project" );
- assertTextPresent( "Project Name" );
- assertElementPresent( "projectName" );
- assertTextPresent( "Version" );
- assertElementPresent( "projectVersion" );
- assertTextPresent( "Scm Url" );
- assertElementPresent( "projectScmUrl" );
- assertTextPresent( "Scm Username" );
- assertElementPresent( "projectScmUsername" );
- assertTextPresent( "Scm Password" );
- assertElementPresent( "projectScmPassword" );
- assertTextPresent( "Scm Branch/Tag" );
- assertElementPresent( "projectScmTag" );
- assertLinkPresent( "Maven SCM URL" );
- }
-
- public void assertAddAntProjectPage()
- {
- assertAddProjectPage( "ant" );
- }
-
- public void assertAddShellProjectPage()
- {
- assertAddProjectPage( "shell" );
- }
-
- // ////////////////////////////////////
- // Project Groups
- // ////////////////////////////////////
- public void goToProjectGroupsSummaryPage()
- throws Exception
- {
- clickLinkWithText( "Show Project Groups" );
-
- assertProjectGroupsSummaryPage();
- }
-
- public void assertProjectGroupsSummaryPage()
- {
- assertPage( "Continuum - Group Summary" );
- assertTextPresent( "Project Groups" );
-
- if ( isTextPresent( "Project Groups list is empty." ) )
- {
- assertTextNotPresent( "Name" );
- assertTextNotPresent( "Group Id" );
- }
- else
- {
- assertTextPresent( "Name" );
- assertTextPresent( "Group Id" );
- }
- }
-
- // ////////////////////////////////////
- // Project Group
- // ////////////////////////////////////
- public void showProjectGroup( String name, String groupId, String description )
- throws Exception
- {
- goToProjectGroupsSummaryPage();
-
- // Checks the link to the created Project Group
- assertLinkPresent( name );
- clickLinkWithText( name );
-
- assertProjectGroupSummaryPage( name, groupId, description );
- }
-
- public void assertProjectGroupSummaryPage( String name, String groupId, String description )
- {
- assertPage( "Continuum - Project Group" );
- assertTextPresent( "Project Group Name" );
- assertTextPresent( name );
- assertTextPresent( "Project Group Id" );
- assertTextPresent( groupId );
- assertTextPresent( "Description" );
- assertTextPresent( description );
-
- // Assert the available Project Group Actions
- assertTextPresent( "Group Actions" );
- assertElementPresent( "build" );
- assertElementPresent( "edit" );
- assertElementPresent( "remove" );
-
- assertTextPresent( "Project Group Scm Root" );
-
- if ( isTextPresent( "Member Projects" ) )
- {
- assertTextPresent( "Project Name" );
- assertTextPresent( "Version" );
- assertTextPresent( "Build" );
- }
- else
- {
- assertTextNotPresent( "Project Name" );
- }
- }
-
- public void addProjectGroup( String name, String groupId, String description, boolean success )
- throws Exception
- {
- goToProjectGroupsSummaryPage();
-
- // Go to Add Project Group Page
- clickButtonWithValue( "Add Project Group" );
- assertAddProjectGroupPage();
-
- // Enter values into Add Project Group fields, and submit
- setFieldValue( "name", name );
- setFieldValue( "groupId", groupId );
- setFieldValue( "description", description );
-
- submit();
- if ( success )
- {
- assertProjectGroupsSummaryPage();
- }
- else
- {
- assertAddProjectGroupPage();
- }
- }
-
- public void assertAddProjectGroupPage()
- {
- assertPage( "Continuum - Add Project Group" );
-
- assertTextPresent( "Add Project Group" );
- assertTextPresent( "Project Group Name" );
- assertElementPresent( "name" );
- assertTextPresent( "Project Group Id" );
- assertElementPresent( "groupId" );
- assertTextPresent( "Description" );
- assertElementPresent( "description" );
- }
-
- public void removeProjectGroup( String name, String groupId, String description )
- throws Exception
- {
- showProjectGroup( name, groupId, description );
-
- // Remove
- clickLinkWithLocator( "remove" );
-
- // Assert Confirmation
- assertElementPresent( "removeProjectGroup_" );
- assertElementPresent( "Cancel" );
-
- // Confirm Project Group deletion
- clickButtonWithValue( "Save" );
- assertProjectGroupsSummaryPage();
- }
-
- public void editProjectGroup( String name, String groupId, String description, String newName, String newDescription )
- throws Exception
- {
- showProjectGroup( name, groupId, description );
- clickButtonWithValue( "Edit" );
- assertEditGroupPage( groupId );
- setFieldValue( "saveProjectGroup_name", newName );
- setFieldValue( "saveProjectGroup_description", newDescription );
- clickButtonWithValue( "Save" );
- }
-
- public void assertEditGroupPage( String groupId )
- throws Exception
- {
- assertPage( "Continuum - Update Project Group" );
- assertTextPresent( "Update Project Group" );
- assertTextPresent( "Project Group Name" );
- assertTextPresent( "Project Group Id" );
- assertTextPresent( groupId );
- assertTextPresent( "Description" );
- assertTextPresent( "Homepage Url" );
- assertTextPresent( "Local Repository" );
- assertElementPresent( "saveProjectGroup_" );
- assertElementPresent( "Cancel" );
- }
-
- public void buildProjectGroup( String projectGroupName, String groupId, String description )
- throws Exception
- {
- int currentIt = 1;
- int maxIt = 20;
- showProjectGroup( projectGroupName, groupId, description );
- clickButtonWithValue( "Build all projects" );
-
- while ( isElementPresent( "//img[@alt='Building']" ) || isElementPresent( "//img[@alt='Updating']" ) )
- {
- Thread.sleep( 10000 );
- geSelenium().refresh();
- waitPage();
- if ( currentIt > maxIt )
- {
- Assert.fail("Timeout, Can't build project group");
- }
- currentIt++;
- }
- clickLinkWithText( p.getProperty( "M2_PROJ_GRP_NAME" ) );
- clickLinkWithText( "Builds" );
- clickLinkWithText( "Result" );
- assertTextPresent( "BUILD SUCCESSFUL" );
- clickLinkWithText( "Project Group Summary" );
- }
-
- public void assertReleaseSuccess()
- {
- assertTextPresent( "Choose Release Goal for Apache Maven" );
- }
-
- public void addValidM2ProjectFromProjectGroup( String projectGroupName, String groupId, String description,
- String m2PomUrl )
- throws Exception
- {
- showProjectGroup( projectGroupName, groupId, description );
- selectValue( "projectTypes", "Add M2 Project" );
- clickButtonWithValue( "Add" );
- assertAddMavenTwoProjectPage();
-
- setFieldValue( "m2PomUrl", m2PomUrl );
- clickButtonWithValue( "Add" );
-
- // if success redirect to summary page
- assertProjectGroupsSummaryPage();
- }
-
- public void goToGroupBuildDefinitionPage( String projectGroupName, String groupId, String description )
- throws Exception
- {
- showProjectGroup( projectGroupName, groupId, description );
- clickLinkWithText( "Build Definitions" );
- assertTextPresent( "Project Group Build Definitions of " + projectGroupName + " group" );
-
- assertGroupBuildDefinitionPage( projectGroupName );
-
- }
-
- public void assertGroupBuildDefinitionPage( String projectGroupName )
- {
-
- assertTextPresent( "Project Group Build Definitions of " + projectGroupName + " group" );
- }
-
- public void assertDeleteBuildDefinitionPage( String description, String goals)
- {
- assertTextPresent( "Are you sure you want to delete the build definition with description \""+description+"\", goals \""+ goals + "\" and id" );
- isButtonWithValuePresent( "Cancel" );
- isButtonWithValuePresent( "Delete" );
- }
-
-
-
- public void assertAddEditBuildDefinitionPage()
- {
- assertTextPresent( "Add/Edit Build Definition" );
- assertTextPresent( "POM filename*:" );
- assertElementPresent( "buildFile" );
- assertTextPresent( "Goals:" );
- assertElementPresent( "goals" );
- assertTextPresent( "Arguments:" );
- assertElementPresent( "arguments" );
- assertTextPresent( "Build Fresh" );
- assertElementPresent( "buildFresh" );
- assertTextPresent( "Always Build" );
- assertElementPresent( "alwaysBuild" );
- assertTextPresent( "Is it default?" );
- assertTextPresent( "Schedule:" );
- assertElementPresent( "scheduleId" );
- assertTextPresent( "Description" );
- assertElementPresent( "description" );
- assertTextPresent( "Type" );
- assertElementPresent( "buildDefinitionType" );
- assertTextPresent( "Build Environment" );
- assertElementPresent( "profileId" );
- }
-
- public void addEditGroupBuildDefinition( String groupName, String buildFile, String goals, String arguments, String description,
- boolean buildFresh, boolean alwaysBuild, boolean isDefault )
- {
- assertAddEditBuildDefinitionPage();
- // Enter values into Add Build Definition fields, and submit
- setFieldValue( "buildFile", buildFile );
- setFieldValue( "goals", goals );
- setFieldValue( "arguments", arguments );
- setFieldValue( "description", description );
-
- if ( buildFresh )
- {
- checkField( "buildFresh" );
- }
- else
- {
- uncheckField( "buildFresh" );
- }
- if ( isElementPresent( "defaultBuildDefinition" ) )
- {
- if ( isDefault )
- {
- checkField( "defaultBuildDefinition" );
- }
- else
- {
- uncheckField( "defaultBuildDefinition" );
- }
- }
- if ( alwaysBuild )
- {
- checkField( "alwaysBuild" );
- }
- else
- {
- uncheckField( "alwaysBuild" );
- }
-
- submit();
- if(groupName != null){
- assertGroupBuildDefinitionPage( groupName );
- } else {
- assertProjectInformationPage();
- }
- }
-
- public void assertGroupNotifierPage( String projectGroupName )
- {
- assertTextPresent( "Project Group Notifiers of group " + projectGroupName );
- }
-
- public void assertProjectNotifierPage()
- {
- assertTextPresent( "Add Notifier" );
- }
-
- public void assertAddNotifierPage()
- {
- assertPage( "Continuum - Add Notifier" );
- assertTextPresent( "Add Notifier" );
- assertTextPresent( "Type" );
- assertElementPresent( "notifierType" );
- assertElementPresent( "Cancel" );
- }
-
- public void assertAddEditMailNotifierPage()
- {
- assertPage( "Continuum - Add/Edit Mail Notifier" );
- assertTextPresent( "Add/Edit Mail Notifier" );
- assertTextPresent( "Mail Recipient Address" );
- assertTextPresent( "Send a mail to latest committers" );
- assertTextPresent( "Send on Success" );
- assertTextPresent( "Send on Failure" );
- assertTextPresent( "Send on Error" );
- assertTextPresent( "Send on Warning" );
- // TODO: Replace On for on
- assertTextPresent( "Send On SCM Failure" );
- assertElementPresent( "address" );
- assertElementPresent( "Cancel" );
- }
-
- public void assertAddEditIrcNotifierPage()
- {
- assertPage( "Continuum - Add/Edit IRC Notifier" );
-
- assertTextPresent( "IRC Host" );
- assertElementPresent( "host" );
-
- assertTextPresent( "IRC port" );
- assertElementPresent( "port" );
-
- assertTextPresent( "IRC channel" );
- assertElementPresent( "channel" );
-
- assertTextPresent( "Nick Name" );
- assertElementPresent( "nick" );
-
- assertTextPresent( "Alternate Nick Name" );
- assertElementPresent( "alternateNick" );
-
- assertTextPresent( "User Name" );
- assertElementPresent( "username" );
-
- assertTextPresent( "Full Name" );
- assertElementPresent( "fullName" );
-
- assertTextPresent( "Password" );
- assertElementPresent( "password" );
-
- assertTextPresent( "SSL" );
- assertTextPresent( "Send on Success" );
- assertTextPresent( "Send on Failure" );
- assertTextPresent( "Send on Error" );
- assertTextPresent( "Send on Warning" );
- assertTextPresent( "Send On SCM Failure" );
- }
-
- public void assertAddEditJabberPage()
- {
- assertPage( "Continuum - Add/Edit Jabber Notifier" );
-
- assertTextPresent( "Jabber Host" );
- assertElementPresent( "host" );
- assertTextPresent( "Jabber port" );
- assertElementPresent( "port" );
- assertTextPresent( "Jabber login" );
- assertElementPresent( "login" );
- assertTextPresent( "Jabber Password" );
- assertElementPresent( "password" );
- assertTextPresent( "Jabber Domain Name" );
- assertElementPresent( "domainName" );
- assertTextPresent( "Jabber Recipient Address" );
- assertElementPresent( "address" );
-
- assertTextPresent( "Is it a SSL connection?" );
- assertTextPresent( "Is it a Jabber group?" );
- assertTextPresent( "Send on Success" );
- assertTextPresent( "Send on Failure" );
- assertTextPresent( "Send on Error" );
- assertTextPresent( "Send on Warning" );
- // TODO: Change On for on
- assertTextPresent( "Send On SCM Failure" );
- }
-
- public void assertAddEditMsnPage()
- {
- assertPage( "Continuum - Add/Edit MSN Notifier" );
-
- assertTextPresent( "MSN login" );
- assertElementPresent( "login" );
- assertTextPresent( "MSN Password" );
- assertElementPresent( "password" );
- assertTextPresent( "MSN Recipient Address" );
- assertElementPresent( "address" );
-
- assertTextPresent( "Send on Success" );
- assertTextPresent( "Send on Failure" );
- assertTextPresent( "Send on Error" );
- assertTextPresent( "Send on Warning" );
- assertTextPresent( "Send On SCM Failure" );
- }
-
- public void assertAddEditWagonPage()
- {
- assertPage( "Continuum - Add/Edit Wagon Notifier" );
-
- assertTextPresent( "Project Site URL" );
- assertTextPresent( "Server Id (defined in your settings.xml for authentication)" );
- assertElementPresent( "url" );
- assertElementPresent( "id" );
- assertTextPresent( "Send on Success" );
- assertTextPresent( "Send on Failure" );
- assertTextPresent( "Send on Error" );
- assertTextPresent( "Send on Warning" );
- }
-
- public void goToGroupNotifier( String projectGroupName, String projectGroupId, String projectGroupDescription )
- throws Exception
- {
- showProjectGroup( projectGroupName, projectGroupId, projectGroupDescription );
- clickLinkWithText( "Notifiers" );
- assertGroupNotifierPage( projectGroupName );
- clickButtonWithValue( "Add" );
- assertAddNotifierPage();
- }
-
- public void goToProjectNotifier( String projectGroupName, String projectName )
- throws Exception
- {
- goToProjectInformationPage( projectGroupName, projectName );
- clickLinkWithXPath( "//input[contains(@id,'addProjectNotifier') and @type='submit']" );
- assertAddNotifierPage();
- }
-
- public void addMailNotifier( String projectGroupName, String projectName, String email, boolean isValid )
- throws Exception
- {
- selectValue( "//select", "Mail" );
- clickButtonWithValue( "Submit" );
- assertAddEditMailNotifierPage();
- setFieldValue( "address", email );
- clickButtonWithValue( "Save" );
-
- if ( !isValid )
- {
- assertTextPresent( "Address is invalid" );
- }
- else if ( projectName != null )
- {
- assertProjectInformationPage();
- }
- else
- {
- assertGroupNotifierPage( projectGroupName );
- }
- }
-
- public void editMailNotifier( String projectGroupName, String projectName, String oldMail, String newMail,
- boolean isValid )
- throws Exception
- {
- if ( projectName == null )
- {
- clickLinkWithXPath( "(//a[contains(@href,'editProjectGroupNotifier') and contains(@href,'mail')])//img" );
- }
- else
- {
- clickLinkWithXPath( "(//a[contains(@href,'editProjectNotifier') and contains(@href,'mail')])//img" );
- }
- assertAddEditMailNotifierPage();
- assertFieldValue( oldMail, "address" );
- setFieldValue( "address", newMail );
- clickButtonWithValue( "Save" );
-
- if ( !isValid )
- {
- assertTextPresent( "Address is invalid" );
- }
- else if ( projectName != null )
- {
- assertProjectInformationPage();
- }
- else
- {
- assertGroupNotifierPage( projectGroupName );
- }
- }
-
- public void addIrcNotifier( String projectGroupName, String projectName, String host, String channel,
- boolean isValid )
- throws Exception
- {
- selectValue( "//select", "IRC" );
- clickButtonWithValue( "Submit" );
- assertAddEditIrcNotifierPage();
- setFieldValue( "host", host );
- setFieldValue( "channel", channel );
-
- clickButtonWithValue( "Save" );
- if ( !isValid )
- {
- assertTextPresent( "Host is required" );
- assertTextPresent( "Channel is required" );
- }
- else if ( projectName != null )
- {
- assertProjectInformationPage();
- }
- else
- {
- assertGroupNotifierPage( projectGroupName );
- }
- }
-
- public void editIrcNotifier( String projectGroupName, String projectName, String oldHost, String oldChannel,
- String newHost, String newChannel, boolean isValid )
- throws Exception
- {
- if ( projectName == null )
- {
- clickLinkWithXPath( "(//a[contains(@href,'editProjectGroupNotifier') and contains(@href,'irc')])//img" );
- }
- else
- {
- clickLinkWithXPath( "(//a[contains(@href,'editProjectNotifier') and contains(@href,'irc')])//img" );
- }
- assertAddEditIrcNotifierPage();
- assertFieldValue( oldHost, "host" );
- assertFieldValue( oldChannel, "channel" );
- setFieldValue( "host", newHost );
- setFieldValue( "channel", newChannel );
- clickButtonWithValue( "Save" );
-
- if ( !isValid )
- {
- assertTextPresent( "Host is required" );
- assertTextPresent( "Channel is required" );
- }
- else if ( projectName != null )
- {
- assertProjectInformationPage();
- }
- else
- {
- assertGroupNotifierPage( projectGroupName );
- }
- }
-
- public void addJabberNotifier( String projectGroupName, String projectName, String host, String login,
- String password, String address, boolean isValid )
- throws Exception
- {
- selectValue( "//select", "Jabber" );
- clickButtonWithValue( "Submit" );
- assertAddEditJabberPage();
- setFieldValue( "host", host );
- setFieldValue( "login", login );
- setFieldValue( "password", password );
- setFieldValue( "address", address );
- clickButtonWithValue( "Save" );
-
- if ( !isValid )
- {
- assertTextPresent( "Host is required" );
- assertTextPresent( "Login is required" );
- assertTextPresent( "Password is required" );
- assertTextPresent( "Address is required" );
- }
- else if ( projectName != null )
- {
- assertProjectInformationPage();
- }
- else
- {
- assertGroupNotifierPage( projectGroupName );
- }
- }
-
- public void editJabberNotifier( String projectGroupName, String projectName, String oldHost, String oldLogin,
- String oldAddress, String newHost, String newLogin, String newPassword,
- String newAddress, boolean isValid )
- throws Exception
- {
- if ( projectName == null )
- {
- clickLinkWithXPath( "(//a[contains(@href,'editProjectGroupNotifier') and contains(@href,'jabber')])//img" );
- }
- else
- {
- clickLinkWithXPath( "(//a[contains(@href,'editProjectNotifier') and contains(@href,'jabber')])//img" );
- }
- assertAddEditJabberPage();
- assertFieldValue( oldHost, "host" );
- assertFieldValue( oldLogin, "login" );
- assertFieldValue( oldAddress, "address" );
- setFieldValue( "host", newHost );
- setFieldValue( "login", newLogin );
- setFieldValue( "password", newPassword );
- setFieldValue( "address", newAddress );
- clickButtonWithValue( "Save" );
-
- if ( !isValid )
- {
- assertTextPresent( "Host is required" );
- assertTextPresent( "Login is required" );
- assertTextPresent( "Password is required" );
- assertTextPresent( "Address is required" );
- }
- else if ( projectName != null )
- {
- assertProjectInformationPage();
- }
- else
- {
- assertGroupNotifierPage( projectGroupName );
- }
- }
-
- public void addMsnNotifier( String projectGroupName, String projectName, String login, String password,
- String recipientAddress, boolean isValid )
- throws Exception
- {
- selectValue( "//select", "MSN" );
- clickButtonWithValue( "Submit" );
- assertAddEditMsnPage();
- setFieldValue( "login", login );
- setFieldValue( "password", password );
- setFieldValue( "address", recipientAddress );
- clickButtonWithValue( "Save" );
-
- if ( !isValid )
- {
- assertTextPresent( "Login is required" );
- assertTextPresent( "Password is required" );
- assertTextPresent( "Address is required" );
- }
- else if ( projectName != null )
- {
- assertProjectInformationPage();
- }
- else
- {
- assertGroupNotifierPage( projectGroupName );
- }
- }
-
- public void editMsnNotifier( String projectGroupName, String projectName, String oldLogin, String oldAddress,
- String newLogin, String newPassword, String newAddress, boolean isValid )
- throws Exception
- {
- if ( projectName == null )
- {
- clickLinkWithXPath( "(//a[contains(@href,'editProjectGroupNotifier') and contains(@href,'msn')])//img" );
- }
- else
- {
- clickLinkWithXPath( "(//a[contains(@href,'editProjectNotifier') and contains(@href,'msn')])//img" );
- }
- assertAddEditMsnPage();
- assertFieldValue( oldLogin, "login" );
- assertFieldValue( oldAddress, "address" );
- setFieldValue( "login", newLogin );
- setFieldValue( "password", newPassword );
- setFieldValue( "address", newAddress );
- clickButtonWithValue( "Save" );
-
- if ( !isValid )
- {
- assertTextPresent( "Login is required" );
- assertTextPresent( "Password is required" );
- assertTextPresent( "Address is required" );
- }
- else if ( projectName != null )
- {
- assertProjectInformationPage();
- }
- else
- {
- assertGroupNotifierPage( projectGroupName );
- }
- }
-
- public void addWagonNotifierPage( String projectGroupName, String projectName, String siteUrl, String serverId,
- boolean isValid )
- throws Exception
- {
- selectValue( "//select", "Wagon" );
- clickButtonWithValue( "Submit" );
- assertAddEditWagonPage();
- setFieldValue( "url", siteUrl );
- setFieldValue( "id", serverId );
- clickButtonWithValue( "Save" );
-
- if ( !isValid )
- {
- assertTextPresent( "Destination URL is required" );
- assertTextPresent( "Server Id is required" );
- }
- else if ( projectName != null )
- {
- assertProjectInformationPage();
- }
- else
- {
- assertGroupNotifierPage( projectGroupName );
- }
- }
-
- public void editWagonNotifier( String projectGroupName, String projectName, String oldUrl, String oldId,
- String newUrl, String newId, boolean isValid )
- throws Exception
- {
- if ( projectName == null )
- {
- clickLinkWithXPath( "(//a[contains(@href,'editProjectGroupNotifier') and contains(@href,'wagon')])//img" );
- }
- else
- {
- clickLinkWithXPath( "(//a[contains(@href,'editProjectNotifier') and contains(@href,'wagon')])//img" );
- }
- assertAddEditWagonPage();
- assertFieldValue( oldUrl, "url" );
- // TODO: BUG: ServerId is not loader
- // assertFieldValue( oldId, "id" );
- setFieldValue( "url", newUrl );
- setFieldValue( "id", newId );
- clickButtonWithValue( "Save" );
-
- if ( !isValid )
- {
- assertTextPresent( "Destination URL is required" );
- assertTextPresent( "Server Id is required" );
- }
- else if ( projectName != null )
- {
- assertProjectInformationPage();
- }
- else
- {
- assertGroupNotifierPage( projectGroupName );
- }
- }
-
- // ////////////////////////////////////
- // General Project Pages
- // ////////////////////////////////////
- public void goToEditProjectPage( String projectGroupName, String projectName )
- {
- clickLinkWithText( "Show Project Groups" );
- clickLinkWithText( projectGroupName );
- clickLinkWithText( projectName );
- clickButtonWithValue( "Edit" );
-
- assertEditProjectPage();
- }
-
- public void assertEditProjectPage()
- {
- assertTextPresent( "Update Continuum Project" );
- assertTextPresent( "Project Name*:" );
- assertElementPresent( "name" );
- assertTextPresent( "Version*:" );
- assertElementPresent( "version" );
- assertTextPresent( "SCM Url*:" );
- assertElementPresent( "scmUrl" );
- assertTextPresent( "Use SCM Credentials Cache, if available" );
- assertElementPresent( "scmUseCache" );
- assertTextPresent( "SCM Username:" );
- assertElementPresent( "scmUsername" );
- assertTextPresent( "SCM Password:" );
- assertElementPresent( "scmPassword" );
- assertTextPresent( "SCM Branch/Tag:" );
- assertElementPresent( "scmTag" );
- }
-
- public void goToAddNotifierPage( String projectGroupName, String projectName )
- {
- clickLinkWithText( "Show Project Groups" );
- clickLinkWithText( projectGroupName );
- clickLinkWithText( projectName );
- geSelenium().click( "addProjectNotifier" );
- clickLinkWithXPath( "//input[@id='addProjectNotifier_0']" );
-
- assertNotifierPage();
- }
-
- public void assertNotifierPage()
- {
- assertPage( "Continuum - Add Notifier" );
- assertTextPresent( "Add Notifier" );
- assertTextPresent( "Type:" );
- assertElementPresent( "notifierType" );
- }
-
- public void addMailNotifier( String projectGroupName, String projectName, String email, boolean success,
- boolean failure, boolean error, boolean warning )
- {
- goToAddNotifierPage( projectGroupName, projectName );
- clickButtonWithValue( "Submit" );
-
- // Enter values into Add Notifier fields, and submit
- setFieldValue( "address", email );
- if ( success )
- {
- checkField( "sendOnSuccess" );
- }
- if ( failure )
- {
- checkField( "sendOnFailure" );
- }
- if ( error )
- {
- checkField( "sendOnError" );
- }
- if ( warning )
- {
- checkField( "sendOnWarning" );
- }
-
- submit();
- assertProjectInformationPage();
- }
-
- public void goToProjectInformationPage( String projectGroupName, String projectName )
- {
- clickLinkWithText( "Show Project Groups" );
- clickLinkWithText( projectGroupName );
- clickLinkWithText( projectName );
-
- assertProjectInformationPage();
- }
-
- public void assertProjectInformationPage()
- {
- assertTextPresent( "Project Group Summary" );
- assertTextPresent( "Project Information" );
- assertTextPresent( "Builds" );
- assertTextPresent( "Working Copy" );
- assertTextPresent( "Build Definitions" );
- assertTextPresent( "Notifiers" );
- assertTextPresent( "Dependencies" );
- assertTextPresent( "Developers" );
- }
-
- public void moveProjectToProjectGroup( String name, String groupId, String description, String newProjectGroup )
- throws Exception
- {
- showProjectGroup( name, groupId, description );
- clickButtonWithValue( "Edit" );
-
- assertTextPresent( "Move to Group" );
- selectValue( "//select[contains(@name,'project')]", newProjectGroup );
- clickButtonWithValue( "Save" );
- }
-
- // ////////////////////////////////////
- // Maven 2.0.x Project
- // ////////////////////////////////////
- public void goToAddMavenTwoProjectPage()
- {
- clickLinkWithText( "Maven 2.0.x Project" );
-
- assertAddMavenTwoProjectPage();
- }
-
- public void assertAddMavenTwoProjectPage()
- {
- assertTextPresent( "POM Url" );
- assertElementPresent( "m2PomUrl" );
- assertTextPresent( "Username" );
- assertElementPresent( "scmUsername" );
- assertTextPresent( "Password" );
- assertElementPresent( "scmPassword" );
- assertTextPresent( "Upload POM" );
- assertElementPresent( "m2PomFile" );
- assertTextPresent( "Project Group" );
- assertElementPresent( "selectedProjectGroup" );
- }
-
- public void addMavenTwoProject( String pomUrl, String username, String password, String projectGroup,
- boolean success )
- throws Exception
- {
- goToAddMavenTwoProjectPage();
-
- // Enter values into Add Maven Two Project fields, and submit
- setFieldValue( "m2PomUrl", pomUrl );
- setFieldValue( "scmUsername", username );
- setFieldValue( "scmPassword", password );
-
- if ( projectGroup != null )
- {
- selectValue( "addMavenTwoProject_selectedProjectGroup", projectGroup );
- }
- submit();
- String ident;
- if ( success )
- {
- ident = "projectGroupSummary";
- }
- else
- {
- ident = "addMavenTwoProject";
- }
- // TODO: Improve the condition
- String condition = "selenium.browserbot.getCurrentWindow().document.getElementById('" + ident + "')";
- // 'Continuum - Project Group'
- geSelenium().waitForCondition( condition, maxWaitTimeInMs );
- }
-
- /**
- * submit the page
- *
- * @param m2PomUrl
- * @param validPom
- */
- public void submitAddMavenTwoProjectPage( String m2PomUrl, boolean validPom )
- throws Exception
- {
- addMavenTwoProject( m2PomUrl, "", "", null, validPom );
-
- if ( validPom )
- {
- assertTextPresent( "Default Project Group" );
- // TODO: Add more tests
- }
- }
-
- // ////////////////////////////////////
- // Maven 1.x Project
- // ////////////////////////////////////
- public void goToAddMavenOneProjectPage()
- {
- clickLinkWithText( "Maven 1.x Project" );
-
- assertAddMavenOneProjectPage();
- }
-
- public void assertAddMavenOneProjectPage()
- {
- assertTextPresent( "POM Url" );
- assertElementPresent( "m1PomUrl" );
- assertTextPresent( "Username" );
- assertElementPresent( "scmUsername" );
- assertTextPresent( "Password" );
- assertElementPresent( "scmPassword" );
- assertTextPresent( "Upload POM" );
- assertElementPresent( "m1PomFile" );
- assertTextPresent( "Project Group" );
- assertElementPresent( "selectedProjectGroup" );
- }
-
- public void addMavenOneProject( String pomUrl, String username, String password, String projectGroup,
- boolean validProject )
- {
- goToAddMavenOneProjectPage();
-
- // Enter values into Add Maven One Project fields, and submit
- setFieldValue( "m1PomUrl", pomUrl );
- setFieldValue( "scmUsername", username );
- setFieldValue( "scmPassword", password );
-
- if ( projectGroup != null )
- {
- selectValue( "addMavenOneProject_selectedProjectGroup", projectGroup );
- }
-
- submit();
-
- geSelenium().waitForCondition( "'' == document.title", maxWaitTimeInMs );
- }
-}
Modified: continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/AbstractSeleniumTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/AbstractSeleniumTest.java?rev=834357&r1=834356&r2=834357&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/AbstractSeleniumTest.java (original)
+++ continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/AbstractSeleniumTest.java Tue Nov 10 05:38:01 2009
@@ -1,316 +0,0 @@
-package org.apache.continuum.web.test;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Map.Entry;
-
-import org.testng.Assert;
-
-import com.thoughtworks.selenium.DefaultSelenium;
-import com.thoughtworks.selenium.Selenium;
-
-/**
- * Based on AbstractSeleniumTestCase of Emmanuel Venisse test.
- *
- * @author José Morales MartÃnez
- * @version $Id$
- */
-public abstract class AbstractSeleniumTest
-{
- public static String baseUrl;
-
- public static String maxWaitTimeInMs;
-
- private static ThreadLocal<Selenium> selenium;
-
- public static Properties p;
-
- /**
- * Initialize selenium an others properties. This method is called from BeforeSuite method of sub-class.
- */
- public void open(int number)
- throws Exception
- {
- p = new Properties();
- p.load( this.getClass().getClassLoader().getResourceAsStream( "testng.properties" ) );
-
- baseUrl = p.getProperty( "BASE_URL" );
- maxWaitTimeInMs = p.getProperty( "MAX_WAIT_TIME_IN_MS" );
-
- String seleniumHost = p.getProperty( "SELENIUM_HOST" );
- int seleniumPort = Integer.parseInt( ( p.getProperty( "SELENIUM_PORT" ) ) );
- String seleniumBrowser = p.getProperty( "SELENIUM_BROWSER" );
- final Selenium s = new DefaultSelenium( seleniumHost, seleniumPort, seleniumBrowser, baseUrl );
- selenium = new ThreadLocal<Selenium>() {
- protected Selenium initialValue() {
- return s;
- }
- };
- geSelenium().start();
- }
-
- protected static Selenium geSelenium()
- {
- return selenium.get();
- }
-
- /**
- * Close selenium session. Called from AfterSuite method of sub-class
- */
- public void close()
- throws Exception
- {
- geSelenium().stop();
- }
-
- // *******************************************************
- // Auxiliar methods. This method help us and simplify test.
- // *******************************************************
-
- public void assertFieldValue( String fieldValue, String fieldName )
- {
- assertElementPresent( fieldName );
- Assert.assertEquals( fieldValue, geSelenium().getValue( fieldName ) );
- }
-
- public void assertPage( String title )
- {
- Assert.assertEquals( getTitle(), title );
- }
-
- public String getTitle()
- {
- return geSelenium().getTitle();
- }
-
- public String getHtmlContent()
- {
- return geSelenium().getHtmlSource();
- }
-
- public void assertTextPresent( String text )
- {
- Assert.assertTrue( geSelenium().isTextPresent( text ), "'" + text + "' isn't present." );
- }
-
- public void assertTextNotPresent( String text )
- {
- Assert.assertFalse( geSelenium().isTextPresent( text ), "'" + text + "' is present." );
- }
-
- public void assertElementPresent( String elementLocator )
- {
- Assert.assertTrue( isElementPresent( elementLocator ), "'" + elementLocator + "' isn't present." );
- }
-
- public void assertElementNotPresent( String elementLocator )
- {
- Assert.assertFalse( isElementPresent( elementLocator ), "'" + elementLocator + "' is present." );
- }
-
- public void assertLinkPresent( String text )
- {
- Assert.assertTrue( isElementPresent( "link=" + text ), "The link '" + text + "' isn't present." );
- }
-
- public void assertLinkNotPresent( String text )
- {
- Assert.assertFalse( isElementPresent( "link=" + text ), "The link '" + text + "' is present." );
- }
-
- public void assertImgWithAlt( String alt )
- {
- assertElementPresent( "//img[@alt='" + alt + "']" );
- }
-
- public void assertImgWithAltAtRowCol( boolean isALink, String alt, int row, int column )
- {
- String locator = "//tr[" + row + "]/td[" + column + "]/";
- locator += isALink ? "a/" : "";
- locator += "img[@alt='" + alt + "']";
-
- assertElementPresent( locator );
- }
-
- public void assertCellValueFromTable( String expected, String tableElement, int row, int column )
- {
- Assert.assertEquals( expected, getCellValueFromTable( tableElement, row, column ) );
- }
-
- public boolean isTextPresent( String text )
- {
- return geSelenium().isTextPresent( text );
- }
-
- public boolean isLinkPresent( String text )
- {
- return isElementPresent( "link=" + text );
- }
-
- public boolean isElementPresent( String locator )
- {
- return geSelenium().isElementPresent( locator );
- }
-
- public void waitPage()
- {
- geSelenium().waitForPageToLoad( maxWaitTimeInMs );
- }
-
- public String getFieldValue( String fieldName )
- {
- return geSelenium().getValue( fieldName );
- }
-
- public String getCellValueFromTable( String tableElement, int row, int column )
- {
- return geSelenium().getTable( tableElement + "." + row + "." + column );
- }
-
- public void selectValue( String locator, String value )
- {
- geSelenium().select( locator, "label=" + value );
- }
-
- public void submit()
- {
- clickLinkWithXPath( "//input[@type='submit']" );
- }
-
- public void assertButtonWithValuePresent( String text )
- {
- Assert.assertTrue( isButtonWithValuePresent( text ), "'" + text + "' button isn't present" );
- }
-
- public void assertButtonWithValueNotPresent( String text )
- {
- Assert.assertFalse( isButtonWithValuePresent( text ), "'" + text + "' button is present" );
- }
-
- public boolean isButtonWithValuePresent( String text )
- {
- return isElementPresent( "//button[@value='" + text + "']" )
- || isElementPresent( "//input[@value='" + text + "']" );
- }
-
- public void clickButtonWithValue( String text )
- {
- clickButtonWithValue( text, true );
- }
-
- public void clickButtonWithValue( String text, boolean wait )
- {
- assertButtonWithValuePresent( text );
-
- if ( isElementPresent( "//button[@value='" + text + "']" ) )
- {
- clickLinkWithXPath( "//button[@value='" + text + "']", wait );
- }
- else
- {
- clickLinkWithXPath( "//input[@value='" + text + "']", wait );
- }
- }
-
- public void clickSubmitWithLocator( String locator )
- {
- clickLinkWithLocator( locator );
- }
-
- public void clickSubmitWithLocator( String locator, boolean wait )
- {
- clickLinkWithLocator( locator, wait );
- }
-
- public void clickImgWithAlt( String alt )
- {
- clickLinkWithLocator( "//img[@alt='" + alt + "']" );
- }
-
- public void clickLinkWithText( String text )
- {
- clickLinkWithText( text, true );
- }
-
- public void clickLinkWithText( String text, boolean wait )
- {
- clickLinkWithLocator( "link=" + text, wait );
- }
-
- public void clickLinkWithXPath( String xpath )
- {
- clickLinkWithXPath( xpath, true );
- }
-
- public void clickLinkWithXPath( String xpath, boolean wait )
- {
- clickLinkWithLocator( "xpath=" + xpath, wait );
- }
-
- public void clickLinkWithLocator( String locator )
- {
- clickLinkWithLocator( locator, true );
- }
-
- public void clickLinkWithLocator( String locator, boolean wait )
- {
- assertElementPresent( locator );
- geSelenium().click( locator );
- if ( wait )
- {
- waitPage();
- }
- }
-
- public void setFieldValues( Map<String, String> fieldMap )
- {
- Map.Entry<String, String> entry;
-
- for ( Iterator<Entry<String, String>> entries = fieldMap.entrySet().iterator(); entries.hasNext(); )
- {
- entry = entries.next();
-
- geSelenium().type( entry.getKey(), entry.getValue() );
- }
- }
-
- public void setFieldValue( String fieldName, String value )
- {
- geSelenium().type( fieldName, value );
- }
-
- public void checkField( String locator )
- {
- geSelenium().check( locator );
- }
-
- public void uncheckField( String locator )
- {
- geSelenium().uncheck( locator );
- }
-
- public boolean isChecked( String locator )
- {
- return geSelenium().isChecked( locator );
- }
-}
Added: continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/AntProjectTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/AntProjectTest.java?rev=834357&view=auto
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/AntProjectTest.java (added)
+++ continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/AntProjectTest.java Tue Nov 10 05:38:01 2009
@@ -0,0 +1,81 @@
+package org.apache.continuum.web.test;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.continuum.web.test.parent.AbstractContinuumTest;
+import org.testng.annotations.Test;
+
+/**
+ * Based on AddAntProjectTestCase of Emmanuel Venisse.
+ *
+ * @author José Morales MartÃnez
+ * @version $Id$
+ */
+@Test( groups = { "antProject" }, dependsOnMethods = { "testWithCorrectUsernamePassword" } )
+public class AntProjectTest
+ extends AbstractContinuumTest
+{
+ @Test( dependsOnMethods = { "testAddProjectGroup" } )
+ public void testAddAntProject()
+ throws Exception
+ {
+ String ANT_NAME = getProperty( "ANT_NAME" );
+ String ANT_DESCRIPTION = getProperty( "ANT_DESCRIPTION" );
+ String ANT_VERSION = getProperty( "ANT_VERSION" );
+ String ANT_TAG = getProperty( "ANT_TAG" );
+ String ANT_SCM_URL = getProperty( "ANT_SCM_URL" );
+ String ANT_SCM_USERNAME = getProperty( "ANT_SCM_USERNAME" );
+ String ANT_SCM_PASSWORD = getProperty( "ANT_SCM_PASSWORD" );
+ String TEST_PROJ_GRP_NAME = getProperty( "TEST_PROJ_GRP_NAME" );
+ String TEST_PROJ_GRP_ID = getProperty( "TEST_PROJ_GRP_ID" );
+ String TEST_PROJ_GRP_DESCRIPTION = getProperty( "TEST_PROJ_GRP_DESCRIPTION" );
+ goToAddAntProjectPage();
+ addProject( ANT_NAME, ANT_DESCRIPTION, ANT_VERSION, ANT_SCM_URL, ANT_SCM_USERNAME, ANT_SCM_PASSWORD, ANT_TAG,
+ false, TEST_PROJ_GRP_NAME, null, true );
+ assertProjectGroupSummaryPage( TEST_PROJ_GRP_NAME, TEST_PROJ_GRP_ID, TEST_PROJ_GRP_DESCRIPTION );
+ }
+
+ public void testSubmitEmptyForm()
+ {
+ goToAddAntProjectPage();
+ submit();
+ assertAddProjectPage( "ant" );
+ assertTextPresent( "Name is required and cannot contain null or spaces only" );
+ assertTextPresent( "Version is required and cannot contain null or spaces only" );
+ assertTextPresent( "SCM Url is required and cannot contain null or spaces only" );
+ }
+
+ @Test( dependsOnMethods = { "testAddAntProject" } )
+ public void testAddDupliedAntProject()
+ throws Exception
+ {
+ String ANT_NAME = getProperty( "ANT_NAME" );
+ String ANT_DESCRIPTION = getProperty( "ANT_DESCRIPTION" );
+ String ANT_VERSION = getProperty( "ANT_VERSION" );
+ String ANT_TAG = getProperty( "ANT_TAG" );
+ String ANT_SCM_URL = getProperty( "ANT_SCM_URL" );
+ String ANT_SCM_USERNAME = getProperty( "ANT_SCM_USERNAME" );
+ String ANT_SCM_PASSWORD = getProperty( "ANT_SCM_PASSWORD" );
+ goToAddAntProjectPage();
+ addProject( ANT_NAME, ANT_DESCRIPTION, ANT_VERSION, ANT_SCM_URL, ANT_SCM_USERNAME, ANT_SCM_PASSWORD, ANT_TAG,
+ false, null, null, false );
+ assertTextPresent( "Project name already exist" );
+ }
+}
Added: continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildAgentsTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildAgentsTest.java?rev=834357&view=auto
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildAgentsTest.java (added)
+++ continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildAgentsTest.java Tue Nov 10 05:38:01 2009
@@ -0,0 +1,165 @@
+package org.apache.continuum.web.test;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+//import org.apache.continuum.web.test.parent.AbstractBuildQueueTest;
+import org.testng.annotations.Test;
+import org.apache.continuum.web.test.parent.AbstractBuildAgentsTest;
+
+
+@Test( groups = { "agent" }, dependsOnMethods = { "testDeleteBuildDefinitionTemplate" } )
+public class BuildAgentsTest
+ extends AbstractBuildAgentsTest
+{
+
+ public void testAddBuildAgent()
+ {
+ String BUILD_AGENT_NAME = getProperty( "BUILD_AGENT_NAME" );
+ String BUILD_AGENT_DESCRIPTION = getProperty( "BUILD_AGENT_DESCRIPTION" );
+ String BUILD_AGENT_NAME2 = getProperty( "BUILD_AGENT_NAME2" );
+ String BUILD_AGENT_DESCRIPTION2 = getProperty( "BUILD_AGENT_DESCRIPTION2" );
+ String BUILD_AGENT_NAME3 = getProperty( "BUILD_AGENT_NAME3" );
+ String BUILD_AGENT_DESCRIPTION3 = getProperty( "BUILD_AGENT_DESCRIPTION3" );
+
+ enableDistributedBuilds();
+ goToAddBuildAgent();
+ addBuildAgent( BUILD_AGENT_NAME, BUILD_AGENT_DESCRIPTION, true );
+ goToAddBuildAgent();
+ addBuildAgent( BUILD_AGENT_NAME2, BUILD_AGENT_DESCRIPTION2, true );
+ goToAddBuildAgent();
+ addBuildAgent( BUILD_AGENT_NAME3, BUILD_AGENT_DESCRIPTION3, true );
+ disableDistributedBuilds();
+ }
+
+ @Test( dependsOnMethods = { "testEditBuildAgent" } )
+ public void testAddAnExistingBuildAgent()
+ {
+ String BUILD_AGENT_NAME = getProperty( "BUILD_AGENT_NAME" );
+ String BUILD_AGENT_DESCRIPTION = getProperty( "BUILD_AGENT_DESCRIPTION" );
+
+ enableDistributedBuilds();
+ goToAddBuildAgent();
+ addBuildAgent( BUILD_AGENT_NAME, BUILD_AGENT_DESCRIPTION, false ) ;
+ assertTextPresent( "Build agent already exists" );
+ disableDistributedBuilds();
+ }
+
+ @Test( dependsOnMethods = { "testAddBuildAgent" } )
+ public void testEditBuildAgent()
+
+ {
+ String BUILD_AGENT_NAME = getProperty( "BUILD_AGENT_NAME" );
+ String BUILD_AGENT_DESCRIPTION = getProperty( "BUILD_AGENT_DESCRIPTION" );
+ String new_agentDescription = "new_agentDescription";
+
+ enableDistributedBuilds();
+ goToEditBuildAgent( BUILD_AGENT_NAME, BUILD_AGENT_DESCRIPTION);
+ addEditBuildAgent( BUILD_AGENT_NAME, new_agentDescription );
+ goToEditBuildAgent( BUILD_AGENT_NAME, new_agentDescription);
+ addEditBuildAgent( BUILD_AGENT_NAME, BUILD_AGENT_DESCRIPTION );
+ disableDistributedBuilds();
+ }
+
+ @Test( dependsOnMethods = { "testAddAnExistingBuildAgent" } )
+ public void testDeleteBuildAgent()
+
+ {
+ enableDistributedBuilds();
+ goToBuildAgentPage();
+ String BUILD_AGENT_NAME3 = getProperty( "BUILD_AGENT_NAME3" );
+ removeBuildAgent( BUILD_AGENT_NAME3 );
+ assertTextNotPresent( BUILD_AGENT_NAME3 );
+ disableDistributedBuilds();
+ }
+
+ @Test( dependsOnMethods = { "testDeleteBuildAgent" } )
+ public void testAddEmptyBuildAgent()
+ {
+ String BUILD_AGENT_DESCRIPTION = getProperty( "BUILD_AGENT_DESCRIPTION" );
+
+ enableDistributedBuilds();
+ goToAddBuildAgent();
+ addBuildAgent( "", BUILD_AGENT_DESCRIPTION, false ) ;
+ assertTextPresent( "Build agent url is required." );
+ disableDistributedBuilds();
+ }
+
+//TESTS FOR BUILD AGENT GROUPS
+
+ @Test( dependsOnMethods = { "testAddBuildAgent" } )
+ public void testAddBuildAgentGroup()
+ throws Exception
+ {
+ String BUILD_AGENT_GROUPNAME = getProperty( "BUILD_AGENT_GROUPNAME" );
+ enableDistributedBuilds();
+ goToAddBuildAgentGroup();
+ addEditBuildAgentGroup( BUILD_AGENT_GROUPNAME, new String[] { "Agent_url_name", "Second_Agent" }, new String[] {}, true );
+ disableDistributedBuilds();
+ }
+
+ @Test( dependsOnMethods = { "testAddBuildAgentGroup" } )
+ public void testEditBuildAgentGroup()
+ throws Exception
+ {
+ String BUILD_AGENT_GROUPNAME = getProperty( "BUILD_AGENT_GROUPNAME" );
+ String newName = "new_agentgroupname";
+ enableDistributedBuilds();
+ goToEditBuildAgentGroup( BUILD_AGENT_GROUPNAME, new String[] { "Agent_url_name", "Second_Agent" } );
+ addEditBuildAgentGroup( newName, new String[] {},
+ new String[] { "Second_Agent" }, true );
+ goToEditBuildAgentGroup( newName, new String[] { "Agent_url_name" } );
+ addEditBuildAgentGroup( BUILD_AGENT_GROUPNAME, new String[] { "Second_Agent" },
+ new String[] {}, true );
+ disableDistributedBuilds();
+ }
+
+ @Test( dependsOnMethods = { "testEditBuildAgentGroup" } )
+ public void testAddAnExistingBuildAgentGroup()
+ throws Exception
+ {
+ String BUILD_AGENT_GROUPNAME = getProperty( "BUILD_AGENT_GROUPNAME" );
+
+ enableDistributedBuilds();
+ goToAddBuildAgentGroup();
+ addEditBuildAgentGroup( BUILD_AGENT_GROUPNAME, new String[] { "Agent_url_name", "Second_Agent" }, new String[] {}, false );
+ assertTextPresent( "Build agent group already exists." );
+ disableDistributedBuilds();
+ }
+
+ @Test( dependsOnMethods = { "testAddAnExistingBuildAgentGroup" } )
+ public void testAddEmptyBuildAgentGroupName()
+ throws Exception
+ {
+ enableDistributedBuilds();
+ goToAddBuildAgentGroup();
+ addEditBuildAgentGroup( "", new String[] {}, new String[] {}, false );
+ assertTextPresent( "Build agent group name required." );
+ disableDistributedBuilds();
+ }
+
+ @Test( dependsOnMethods = { "testAddEmptyBuildAgentGroupName" } )
+ public void testDeleteBuildAgentGroup()
+ {
+ String BUILD_AGENT_GROUPNAME = getProperty( "BUILD_AGENT_GROUPNAME" );
+ enableDistributedBuilds();
+ removeBuildAgentGroup( BUILD_AGENT_GROUPNAME );
+ disableDistributedBuilds();
+ }
+}
Added: continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildDefinitionTemplateTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildDefinitionTemplateTest.java?rev=834357&view=auto
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildDefinitionTemplateTest.java (added)
+++ continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildDefinitionTemplateTest.java Tue Nov 10 05:38:01 2009
@@ -0,0 +1,113 @@
+package org.apache.continuum.web.test;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.continuum.web.test.parent.AbstractBuildDefinitionTemplateTest;
+import org.testng.annotations.Test;
+
+/**
+ * @author José Morales MartÃnez
+ * @version $Id$
+ */
+@Test( groups = { "buildDefinitionTemplate" }, dependsOnMethods = { "testWithCorrectUsernamePassword" } )
+public class BuildDefinitionTemplateTest
+ extends AbstractBuildDefinitionTemplateTest
+{
+ public void testAddTemplate()
+ throws Exception
+ {
+ String TEMPLATE_NAME = getProperty( "TEMPLATE_NAME" );
+ goToAddTemplate();
+ addEditTemplate( TEMPLATE_NAME, new String[] { "Default Maven 2 Build Definition",
+ "Default Maven 1 Build Definition" }, new String[] {}, true );
+ }
+
+ public void testAddInvalidTemplate()
+ throws Exception
+ {
+ goToAddTemplate();
+ addEditTemplate( "", new String[] {}, new String[] {}, false );
+ assertTextPresent( "Name is required" );
+ }
+
+ @Test( dependsOnMethods = { "testAddTemplate" } )
+ public void testEditTemplate()
+ throws Exception
+ {
+ String TEMPLATE_NAME = getProperty( "TEMPLATE_NAME" );
+ String newName = "new_name";
+ goToEditTemplate( TEMPLATE_NAME, new String[] { "Default Maven 2 Build Definition",
+ "Default Maven 1 Build Definition" } );
+ addEditTemplate( newName, new String[] { "Default Shell Build Definition" },
+ new String[] { "Default Maven 2 Build Definition" }, true );
+ goToEditTemplate( newName,
+ new String[] { "Default Maven 1 Build Definition", "Default Shell Build Definition" } );
+ addEditTemplate( TEMPLATE_NAME, new String[] { "Default Maven 2 Build Definition" },
+ new String[] { "Default Shell Build Definition" }, true );
+ }
+
+ @Test( dependsOnMethods = { "testEditTemplate" } )
+ public void testDeleteTemplate()
+ {
+ String TEMPLATE_NAME = getProperty( "TEMPLATE_NAME" );
+ removeTemplate( TEMPLATE_NAME );
+ }
+
+ public void testAddBuildDefinitionTemplate()
+ throws Exception
+ {
+ String TEMPLATE_BUILD_POM_NAME = getProperty( "TEMPLATE_BUILD_POM_NAME" );
+ String TEMPLATE_BUILD_GOALS = getProperty( "TEMPLATE_BUILD_GOALS" );
+ String TEMPLATE_BUILD_ARGUMENTS = getProperty( "TEMPLATE_BUILD_ARGUMENTS" );
+ String TEMPLATE_BUILD_DESCRIPTION = getProperty( "TEMPLATE_BUILD_DESCRIPTION" );
+ goToAddBuildDefinitionTemplate();
+ addEditBuildDefinitionTemplate( TEMPLATE_BUILD_POM_NAME, TEMPLATE_BUILD_GOALS, TEMPLATE_BUILD_ARGUMENTS,
+ TEMPLATE_BUILD_DESCRIPTION, true, true, true, true );
+ }
+
+ public void testAddInvalidBuildDefinitionTemplate()
+ throws Exception
+ {
+ goToAddBuildDefinitionTemplate();
+ addEditBuildDefinitionTemplate( "", "", "", "", true, true, true, false );
+ assertTextPresent( "BuildFile is required" );
+ assertTextPresent( "Description is required" );
+ }
+
+ @Test( dependsOnMethods = { "testAddBuildDefinitionTemplate" } )
+ public void testEditBuildDefinitionTemplate()
+ throws Exception
+ {
+ String TEMPLATE_BUILD_POM_NAME = getProperty( "TEMPLATE_BUILD_POM_NAME" );
+ String TEMPLATE_BUILD_GOALS = getProperty( "TEMPLATE_BUILD_GOALS" );
+ String TEMPLATE_BUILD_ARGUMENTS = getProperty( "TEMPLATE_BUILD_ARGUMENTS" );
+ String TEMPLATE_BUILD_DESCRIPTION = getProperty( "TEMPLATE_BUILD_DESCRIPTION" );
+ goToEditBuildDefinitionTemplate( TEMPLATE_BUILD_DESCRIPTION );
+ addEditBuildDefinitionTemplate( TEMPLATE_BUILD_POM_NAME, TEMPLATE_BUILD_GOALS, TEMPLATE_BUILD_ARGUMENTS,
+ TEMPLATE_BUILD_DESCRIPTION, false, false, false, true );
+ }
+
+ @Test( dependsOnMethods = { "testEditBuildDefinitionTemplate" } )
+ public void testDeleteBuildDefinitionTemplate()
+ {
+ String TEMPLATE_BUILD_DESCRIPTION = getProperty( "TEMPLATE_BUILD_DESCRIPTION" );
+ removeBuildDefinitionTemplate( TEMPLATE_BUILD_DESCRIPTION );
+ }
+}
Modified: continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildDefinitionTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildDefinitionTest.java?rev=834357&r1=834356&r2=834357&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildDefinitionTest.java (original)
+++ continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildDefinitionTest.java Tue Nov 10 05:38:01 2009
@@ -19,6 +19,7 @@
* under the License.
*/
+import org.apache.continuum.web.test.parent.AbstractContinuumTest;
import org.testng.annotations.Test;
/**
@@ -32,9 +33,9 @@
public void testDefaultGroupBuildDefinition()
throws Exception
{
- String DEFAULT_PROJ_GRP_NAME = p.getProperty( "DEFAULT_PROJ_GRP_NAME" );
- String DEFAULT_PROJ_GRP_ID = p.getProperty( "DEFAULT_PROJ_GRP_ID" );
- String DEFAULT_PROJ_GRP_DESCRIPTION = p.getProperty( "DEFAULT_PROJ_GRP_DESCRIPTION" );
+ String DEFAULT_PROJ_GRP_NAME = getProperty( "DEFAULT_PROJ_GRP_NAME" );
+ String DEFAULT_PROJ_GRP_ID = getProperty( "DEFAULT_PROJ_GRP_ID" );
+ String DEFAULT_PROJ_GRP_DESCRIPTION = getProperty( "DEFAULT_PROJ_GRP_DESCRIPTION" );
goToGroupBuildDefinitionPage( DEFAULT_PROJ_GRP_NAME, DEFAULT_PROJ_GRP_ID, DEFAULT_PROJ_GRP_DESCRIPTION );
String tableElement = "ec_table";
@@ -69,9 +70,9 @@
public void testAddInvalidGroupBuildDefinition()
throws Exception
{
- String TEST2_PROJ_GRP_NAME = p.getProperty( "TEST2_PROJ_GRP_NAME" );
- String TEST2_PROJ_GRP_ID = p.getProperty( "TEST2_PROJ_GRP_ID" );
- String TEST2_PROJ_GRP_DESCRIPTION = p.getProperty( "TEST2_PROJ_GRP_DESCRIPTION" );
+ String TEST2_PROJ_GRP_NAME = getProperty( "TEST2_PROJ_GRP_NAME" );
+ String TEST2_PROJ_GRP_ID = getProperty( "TEST2_PROJ_GRP_ID" );
+ String TEST2_PROJ_GRP_DESCRIPTION = getProperty( "TEST2_PROJ_GRP_DESCRIPTION" );
goToGroupBuildDefinitionPage( TEST2_PROJ_GRP_NAME, TEST2_PROJ_GRP_ID, TEST2_PROJ_GRP_DESCRIPTION );
clickButtonWithValue( "Add" );
setFieldValue( "buildFile", "" );
@@ -83,25 +84,25 @@
public void testBuildFromGroupBuildDefinition()
throws Exception
{
- String TEST2_PROJ_GRP_NAME = p.getProperty( "TEST2_PROJ_GRP_NAME" );
- String TEST2_PROJ_GRP_ID = p.getProperty( "TEST2_PROJ_GRP_ID" );
- String TEST2_PROJ_GRP_DESCRIPTION = p.getProperty( "TEST2_PROJ_GRP_DESCRIPTION" );
+ String TEST2_PROJ_GRP_NAME = getProperty( "TEST2_PROJ_GRP_NAME" );
+ String TEST2_PROJ_GRP_ID = getProperty( "TEST2_PROJ_GRP_ID" );
+ String TEST2_PROJ_GRP_DESCRIPTION = getProperty( "TEST2_PROJ_GRP_DESCRIPTION" );
goToGroupBuildDefinitionPage( TEST2_PROJ_GRP_NAME, TEST2_PROJ_GRP_ID, TEST2_PROJ_GRP_DESCRIPTION );
clickImgWithAlt( "Build" );
- assertProjectGroupsSummaryPage();
+ assertProjectGroupSummaryPage( TEST2_PROJ_GRP_NAME, TEST2_PROJ_GRP_ID, TEST2_PROJ_GRP_DESCRIPTION );
}
@Test( dependsOnMethods = { "testAddProjectGroup2" } )
public void testAddDefautltGroupBuildDefinition()
throws Exception
{
- String TEST2_PROJ_GRP_NAME = p.getProperty( "TEST2_PROJ_GRP_NAME" );
- String TEST2_PROJ_GRP_ID = p.getProperty( "TEST2_PROJ_GRP_ID" );
- String TEST2_PROJ_GRP_DESCRIPTION = p.getProperty( "TEST2_PROJ_GRP_DESCRIPTION" );
- String BUILD_POM_NAME = p.getProperty( "BUILD_POM_NAME" );
- String BUILD_GOALS = p.getProperty( "BUILD_GOALS" );
- String BUILD_ARGUMENTS = p.getProperty( "BUILD_ARGUMENTS" );
- String BUILD_DESCRIPTION = p.getProperty( "BUILD_DESCRIPTION" );
+ String TEST2_PROJ_GRP_NAME = getProperty( "TEST2_PROJ_GRP_NAME" );
+ String TEST2_PROJ_GRP_ID = getProperty( "TEST2_PROJ_GRP_ID" );
+ String TEST2_PROJ_GRP_DESCRIPTION = getProperty( "TEST2_PROJ_GRP_DESCRIPTION" );
+ String BUILD_POM_NAME = getProperty( "BUILD_POM_NAME" );
+ String BUILD_GOALS = getProperty( "BUILD_GOALS" );
+ String BUILD_ARGUMENTS = getProperty( "BUILD_ARGUMENTS" );
+ String BUILD_DESCRIPTION = getProperty( "BUILD_DESCRIPTION" );
goToGroupBuildDefinitionPage( TEST2_PROJ_GRP_NAME, TEST2_PROJ_GRP_ID, TEST2_PROJ_GRP_DESCRIPTION );
clickButtonWithValue( "Add" );
addEditGroupBuildDefinition( TEST2_PROJ_GRP_NAME, BUILD_POM_NAME, BUILD_GOALS, BUILD_ARGUMENTS,
@@ -112,13 +113,13 @@
public void testAddNotDefautltGroupBuildDefinition()
throws Exception
{
- String TEST2_PROJ_GRP_NAME = p.getProperty( "TEST2_PROJ_GRP_NAME" );
- String TEST2_PROJ_GRP_ID = p.getProperty( "TEST2_PROJ_GRP_ID" );
- String TEST2_PROJ_GRP_DESCRIPTION = p.getProperty( "TEST2_PROJ_GRP_DESCRIPTION" );
- String BUILD_POM_NAME = p.getProperty( "BUILD_POM_NAME" );
- String BUILD_GOALS = p.getProperty( "BUILD_GOALS" );
- String BUILD_ARGUMENTS = p.getProperty( "BUILD_ARGUMENTS" );
- String BUILD_DESCRIPTION = p.getProperty( "BUILD_DESCRIPTION" );
+ String TEST2_PROJ_GRP_NAME = getProperty( "TEST2_PROJ_GRP_NAME" );
+ String TEST2_PROJ_GRP_ID = getProperty( "TEST2_PROJ_GRP_ID" );
+ String TEST2_PROJ_GRP_DESCRIPTION = getProperty( "TEST2_PROJ_GRP_DESCRIPTION" );
+ String BUILD_POM_NAME = getProperty( "BUILD_POM_NAME" );
+ String BUILD_GOALS = getProperty( "BUILD_GOALS" );
+ String BUILD_ARGUMENTS = getProperty( "BUILD_ARGUMENTS" );
+ String BUILD_DESCRIPTION = getProperty( "BUILD_DESCRIPTION" );
goToGroupBuildDefinitionPage( TEST2_PROJ_GRP_NAME, TEST2_PROJ_GRP_ID, TEST2_PROJ_GRP_DESCRIPTION );
clickButtonWithValue( "Add" );
addEditGroupBuildDefinition( TEST2_PROJ_GRP_NAME, BUILD_POM_NAME, BUILD_GOALS, BUILD_ARGUMENTS,
@@ -129,13 +130,13 @@
public void testEditGroupBuildDefinition()
throws Exception
{
- String TEST2_PROJ_GRP_NAME = p.getProperty( "TEST2_PROJ_GRP_NAME" );
- String TEST2_PROJ_GRP_ID = p.getProperty( "TEST2_PROJ_GRP_ID" );
- String TEST2_PROJ_GRP_DESCRIPTION = p.getProperty( "TEST2_PROJ_GRP_DESCRIPTION" );
- String BUILD_POM_NAME = p.getProperty( "BUILD_POM_NAME" );
- String BUILD_GOALS = p.getProperty( "BUILD_GOALS" );
- String BUILD_ARGUMENTS = p.getProperty( "BUILD_ARGUMENTS" );
- String BUILD_DESCRIPTION = p.getProperty( "BUILD_DESCRIPTION" );
+ String TEST2_PROJ_GRP_NAME = getProperty( "TEST2_PROJ_GRP_NAME" );
+ String TEST2_PROJ_GRP_ID = getProperty( "TEST2_PROJ_GRP_ID" );
+ String TEST2_PROJ_GRP_DESCRIPTION = getProperty( "TEST2_PROJ_GRP_DESCRIPTION" );
+ String BUILD_POM_NAME = getProperty( "BUILD_POM_NAME" );
+ String BUILD_GOALS = getProperty( "BUILD_GOALS" );
+ String BUILD_ARGUMENTS = getProperty( "BUILD_ARGUMENTS" );
+ String BUILD_DESCRIPTION = getProperty( "BUILD_DESCRIPTION" );
String newPom = "newpom.xml";
String newGoals = "new goals";
String newArguments = "new arguments";
@@ -153,11 +154,11 @@
public void testDeleteGroupBuildDefinition()
throws Exception
{
- String TEST2_PROJ_GRP_NAME = p.getProperty( "TEST2_PROJ_GRP_NAME" );
- String TEST2_PROJ_GRP_ID = p.getProperty( "TEST2_PROJ_GRP_ID" );
- String TEST2_PROJ_GRP_DESCRIPTION = p.getProperty( "TEST2_PROJ_GRP_DESCRIPTION" );
- String BUILD_GOALS = p.getProperty( "BUILD_GOALS" );
- String BUILD_DESCRIPTION = p.getProperty( "BUILD_DESCRIPTION" );
+ String TEST2_PROJ_GRP_NAME = getProperty( "TEST2_PROJ_GRP_NAME" );
+ String TEST2_PROJ_GRP_ID = getProperty( "TEST2_PROJ_GRP_ID" );
+ String TEST2_PROJ_GRP_DESCRIPTION = getProperty( "TEST2_PROJ_GRP_DESCRIPTION" );
+ String BUILD_GOALS = getProperty( "BUILD_GOALS" );
+ String BUILD_DESCRIPTION = getProperty( "BUILD_DESCRIPTION" );
goToGroupBuildDefinitionPage( TEST2_PROJ_GRP_NAME, TEST2_PROJ_GRP_ID, TEST2_PROJ_GRP_DESCRIPTION );
// Click in Delete Image
clickLinkWithXPath( "(//a[contains(@href,'removeGroupBuildDefinition')])//img" );
@@ -166,16 +167,16 @@
assertGroupBuildDefinitionPage( TEST2_PROJ_GRP_NAME );
}
- @Test( dependsOnMethods = { "testAddMavenTwoProjectFromRemoteSourceToNonDefaultProjectGroup" } )
+ @Test( dependsOnMethods = { "testMoveProject" } )
public void testAddNotDefautltProjectBuildDefinition()
throws Exception
{
- String TEST_PROJ_GRP_NAME = p.getProperty( "TEST_PROJ_GRP_NAME" );
- String M2_PROJ_GRP_NAME = p.getProperty( "M2_PROJ_GRP_NAME" );
- String BUILD_POM_NAME = p.getProperty( "BUILD_POM_NAME" );
- String BUILD_GOALS = p.getProperty( "BUILD_GOALS" );
- String BUILD_ARGUMENTS = p.getProperty( "BUILD_ARGUMENTS" );
- String BUILD_DESCRIPTION = p.getProperty( "BUILD_DESCRIPTION" );
+ String TEST_PROJ_GRP_NAME = getProperty( "TEST_PROJ_GRP_NAME" );
+ String M2_PROJ_GRP_NAME = getProperty( "M2_PROJ_GRP_NAME" );
+ String BUILD_POM_NAME = getProperty( "BUILD_POM_NAME" );
+ String BUILD_GOALS = getProperty( "BUILD_GOALS" );
+ String BUILD_ARGUMENTS = getProperty( "BUILD_ARGUMENTS" );
+ String BUILD_DESCRIPTION = getProperty( "BUILD_DESCRIPTION" );
goToProjectInformationPage( TEST_PROJ_GRP_NAME, M2_PROJ_GRP_NAME );
clickLinkWithXPath( "//input[contains(@id,'buildDefinition')]" );
addEditGroupBuildDefinition( null, BUILD_POM_NAME, BUILD_GOALS, BUILD_ARGUMENTS, BUILD_DESCRIPTION, false,
@@ -186,10 +187,10 @@
public void testDeleteProjectBuildDefinition()
throws Exception
{
- String TEST_PROJ_GRP_NAME = p.getProperty( "TEST_PROJ_GRP_NAME" );
- String M2_PROJ_GRP_NAME = p.getProperty( "M2_PROJ_GRP_NAME" );
- String BUILD_GOALS = p.getProperty( "BUILD_GOALS" );
- String BUILD_DESCRIPTION = p.getProperty( "BUILD_DESCRIPTION" );
+ String TEST_PROJ_GRP_NAME = getProperty( "TEST_PROJ_GRP_NAME" );
+ String M2_PROJ_GRP_NAME = getProperty( "M2_PROJ_GRP_NAME" );
+ String BUILD_GOALS = getProperty( "BUILD_GOALS" );
+ String BUILD_DESCRIPTION = getProperty( "BUILD_DESCRIPTION" );
goToProjectInformationPage( TEST_PROJ_GRP_NAME, M2_PROJ_GRP_NAME );
// Click in Delete Image
clickLinkWithXPath( "(//a[contains(@href,'removeProjectBuildDefinition')])//img" );
Added: continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildEnvironmentTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildEnvironmentTest.java?rev=834357&view=auto
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildEnvironmentTest.java (added)
+++ continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildEnvironmentTest.java Tue Nov 10 05:38:01 2009
@@ -0,0 +1,84 @@
+package org.apache.continuum.web.test;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.continuum.web.test.parent.AbstractBuildEnvironmentTest;
+import org.testng.annotations.Test;
+
+/**
+ * @author José Morales MartÃnez
+ * @version $Id$
+ */
+@Test( groups = { "buildEnvironment" }, dependsOnMethods = { "testWithCorrectUsernamePassword" } )
+public class BuildEnvironmentTest
+ extends AbstractBuildEnvironmentTest
+{
+ public void testAddBuildEnvironment()
+ {
+ String BUIL_ENV_NAME = getProperty( "BUIL_ENV_NAME" );
+ goToAddBuildEnvironment();
+ addBuildEnvironment( BUIL_ENV_NAME, new String[] {}, true );
+ }
+
+ public void testAddInvalidBuildEnvironment()
+ {
+ goToAddBuildEnvironment();
+ addBuildEnvironment( "", new String[] {}, false );
+ assertTextPresent( "You must define a name" );
+ }
+
+ @Test( dependsOnMethods = { "testAddBuildEnvironment" } )
+ public void testEditInvalidBuildEnvironment()
+ {
+ String BUIL_ENV_NAME = getProperty( "BUIL_ENV_NAME" );
+ goToEditBuildEnvironment( BUIL_ENV_NAME );
+ editBuildEnvironment( "", new String[] {}, false );
+ assertTextPresent( "You must define a name" );
+ }
+
+ @Test( dependsOnMethods = { "testAddBuildEnvironment" } )
+ public void testAddDuplicatedBuildEnvironment()
+ {
+ String BUIL_ENV_NAME = getProperty( "BUIL_ENV_NAME" );
+ goToAddBuildEnvironment();
+ addBuildEnvironment( BUIL_ENV_NAME, new String[] {}, false );
+ assertTextPresent( "A Build Environment with the same name already exists" );
+ }
+
+ @Test( dependsOnMethods = { "testAddBuildEnvironment" } )
+ public void testEditBuildEnvironment()
+ {
+ String BUIL_ENV_NAME = getProperty( "BUIL_ENV_NAME" );
+ String newName = "new_name";
+ goToEditBuildEnvironment( BUIL_ENV_NAME );
+ editBuildEnvironment( newName, new String[] {}, true );
+ // TODO: ADD INSTALLATIONS TO ENVIROTMENT
+ goToEditBuildEnvironment( newName );
+ editBuildEnvironment( BUIL_ENV_NAME, new String[] {}, true );
+ }
+
+ @Test( dependsOnMethods = { "testEditInvalidBuildEnvironment", "testEditBuildEnvironment",
+ "testAddDuplicatedBuildEnvironment", "testEditInvalidBuildEnvironment" } )
+ public void testDeleteBuildEnvironment()
+ {
+ String BUIL_ENV_NAME = getProperty( "BUIL_ENV_NAME" );
+ removeBuildEnvironment( BUIL_ENV_NAME );
+ }
+}
Added: continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ConfigurationTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ConfigurationTest.java?rev=834357&view=auto
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ConfigurationTest.java (added)
+++ continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ConfigurationTest.java Tue Nov 10 05:38:01 2009
@@ -0,0 +1,87 @@
+package org.apache.continuum.web.test;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.continuum.web.test.parent.AbstractConfigurationTest;
+import org.testng.annotations.Test;
+
+/**
+ * @author José Morales MartÃnez
+ * @version $Id$
+ */
+@Test( groups = { "configuration" }, dependsOnMethods = { "testWithCorrectUsernamePassword" } )
+public class ConfigurationTest
+ extends AbstractConfigurationTest
+{
+ private String WORKING_DIRECTORY;
+
+ private String BASE_URL;
+
+ private String BUILD_OUTPUT_DIRECTORY;
+
+ private String RELEASE_OUTPUT_DIRECTORY;
+
+ private String DEPLOYMENT_REPOSITORY_DIRECTORY;
+
+ private String NUMBER_ALLOWED_PARALLEL;
+
+ public void defaultConfiguration()
+ {
+ goToConfigurationPage();
+ WORKING_DIRECTORY = getFieldValue( "workingDirectory" );
+ BASE_URL = getFieldValue( "baseUrl" );
+ BUILD_OUTPUT_DIRECTORY = getFieldValue( "buildOutputDirectory" );
+ RELEASE_OUTPUT_DIRECTORY = getFieldValue( "releaseOutputDirectory" );
+ DEPLOYMENT_REPOSITORY_DIRECTORY = getFieldValue( "deploymentRepositoryDirectory" );
+ NUMBER_ALLOWED_PARALLEL = getFieldValue( "numberOfAllowedBuildsinParallel" );
+ }
+
+ @Test( dependsOnMethods = { "defaultConfiguration" } )
+ public void editConfiguration()
+ {
+ String newWorking = "newWorking";
+ String newUrl = "http://localhost:8181";
+ String newBuildOutput = "newBuildOutput";
+ String newReleaseOutput = "newReleaseOutput";
+ String newDeployRepository = "newDeployRepository";
+ String newNumberParallel = "9";
+ goToConfigurationPage();
+ submitConfiguration( newWorking, newBuildOutput, newReleaseOutput, newDeployRepository, newUrl,
+ newNumberParallel, true, true );
+ clickButtonWithValue( "Edit" );
+ submitConfiguration( WORKING_DIRECTORY, BUILD_OUTPUT_DIRECTORY, RELEASE_OUTPUT_DIRECTORY,
+ DEPLOYMENT_REPOSITORY_DIRECTORY, BASE_URL, NUMBER_ALLOWED_PARALLEL, false, true );
+ }
+
+ public void setInvalidConfiguration()
+ {
+ goToConfigurationPage();
+ submitConfiguration( "", "", "", "", "", "", true, false );
+ assertTextPresent( "You must define a working directory" );
+ assertTextPresent( "You must define a build output directory" );
+ assertTextPresent( "You must define a URL" );
+ }
+
+ public void setZeroParallelBuilds()
+ {
+ setMaxBuildQueue( 0 );
+ assertTextPresent( "Number of Allowed Builds in Parallel must be greater than zero" );
+ }
+}