|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--junit.framework.Assert | +--junit.framework.TestCase | +--junit.log4j.LoggedTestCase | +--openfuture.bugbase.test.common.BusinessTestCase
Abstract base class for Bug Base business test cases.
Created: Sun Oct 28 19:16:03 2001
Fields inherited from class junit.log4j.LoggedTestCase |
category, isLog4jInClasspath |
Constructor Summary | |
BusinessTestCase(java.lang.String name)
Creates a new BusinessTestCase instance.
|
Method Summary | |
protected com.meterware.httpunit.WebResponse |
callPage(com.meterware.httpunit.WebConversation wc,
java.lang.String jsp)
Call a page. |
static User |
createAdminUser(java.util.LinkedList users)
Create a new user with password "test". |
BugReport |
createCompleteBugReport(java.lang.String groupid)
Creates a complete bug report. |
static BugReport |
createCompleteBugReport(java.lang.String title,
java.lang.String description,
java.lang.String packageName,
java.lang.String groupid,
java.lang.String errorLevel)
Create a bug report with all required attributes: |
static User |
createDoctorUser(java.util.LinkedList users)
Create a new user with password "test". |
static User |
createNormalUser(java.util.LinkedList users)
Create a unique normal user
with initial name "test_user" . |
static User |
createNormalUser(java.lang.String userid,
java.util.LinkedList users)
Create a new user with password "test". |
static java.lang.String |
createUniqueUserId(java.lang.String initial,
java.util.LinkedList users)
Create a unique user ID |
protected com.meterware.httpunit.WebRequest |
fillReportForm(com.meterware.httpunit.WebForm form,
java.lang.String title,
java.lang.String description,
java.lang.String packageName,
java.lang.String groupid,
java.lang.String errorLevel)
Fill the bug report form with the given parameters |
static com.meterware.httpunit.WebForm |
findForm(com.meterware.httpunit.WebForm[] forms,
java.lang.String action)
Find a certain form. |
static com.meterware.httpunit.WebLink |
findLink(com.meterware.httpunit.WebLink[] links,
java.lang.String reference)
Find a certain link. |
static com.meterware.httpunit.WebLink |
findLinkByText(com.meterware.httpunit.WebLink[] links,
java.lang.String reference)
Find a certain link. |
User |
getAdminUser()
Get the value of adminUser. |
BugBaseServletClient |
getClient()
Get the value of client. |
User |
getDoctorUser()
Get the value of doctorUser. |
User |
getNormalUser()
Get the value of normalUser. |
java.util.ResourceBundle |
getResourceBundle()
Get the value of resourceBundle. |
static java.io.File |
getUniqueFilename(java.lang.String prefix,
java.lang.String suffix,
java.io.File currentDirectory)
Create a new filename in the given directory. |
static boolean |
hasReasonKey(I18NException ex,
java.lang.String reasonKey)
Search in the reasons of the given exceptions if there is a reason with the given key. |
static boolean |
isUniqueUserId(java.lang.String userid,
java.util.LinkedList users)
Check, if the list of users contains a user with user ID userid . |
static User |
login(BugBaseServletClient client,
java.lang.String userid,
java.lang.String password)
Tries to establish a new connection to Bug Base. |
protected com.meterware.httpunit.WebResponse |
login(User user,
com.meterware.httpunit.WebConversation wc,
com.meterware.httpunit.WebResponse resp,
boolean searchLogin)
Login into Bug Base using HttpUnit. |
com.meterware.httpunit.WebResponse |
loginPage(User user,
com.meterware.httpunit.WebConversation wc,
java.lang.String jsp,
boolean searchLogin)
Call a page, that requires a login first. |
com.meterware.httpunit.WebResponse |
loginPage(com.meterware.httpunit.WebConversation wc,
java.lang.String jsp,
boolean searchLogin)
Executes loginPage() with normal user |
protected com.meterware.httpunit.WebResponse |
logoff(com.meterware.httpunit.WebConversation wc,
com.meterware.httpunit.WebResponse resp)
Logoff from Bug Base. |
com.meterware.httpunit.WebResponse |
logoffPage(com.meterware.httpunit.WebConversation wc,
java.lang.String jsp)
Call a page and logoff directly. |
static User |
searchUser(java.lang.String userid,
java.util.LinkedList users)
Search the user in the list with the given user ID. |
void |
setAdminUser(User v)
Set the value of adminUser. |
void |
setClient(BugBaseServletClient v)
Set the value of client. |
protected void |
setDefault(java.lang.String key,
java.lang.String value)
Set a property to a default value, if the property is NOT already set. |
void |
setDoctorUser(User v)
Set the value of doctorUser. |
void |
setNormalUser(User v)
Set the value of normalUser. |
void |
setResourceBundle(java.util.ResourceBundle v)
Set the value of resourceBundle. |
void |
setUp()
Set Up for the test case: Create a Bug Base Servlet Proxy .
|
void |
tearDown()
Remove the test users from Bug Base. |
Methods inherited from class junit.log4j.LoggedTestCase |
debug, debug, error, error, fatal, fatal, getProperties, info, info, setProperties, warn, warn |
Methods inherited from class junit.framework.TestCase |
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString |
Methods inherited from class junit.framework.Assert |
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public BusinessTestCase(java.lang.String name)
BusinessTestCase
instance.
Read the property file "bugbase.properties" from the
current directory. The following properties are recognized:
Finally, the resource bundle
is loaded from
openfuture.bugbase.BugBaseRes_txt
.
name
- a String
valueMethod Detail |
public void setUp() throws java.lang.Exception
Bug Base Servlet Proxy
.
The URL to the
BugBaseServlet
is constructed as
http://<openfuture.bugbase.test.host>/<openfuture.bugbase.test.context>/servlet/BugBaseServlet
..
new user
with password "test". This user belongs only to
the group "users".new user
with password "test". This user belongs to
the groups "users" and "doctors".new user
with password "test". This user belongs to
the groups "users", "doctors" and "admin".setUp
in class LoggedTestCase
java.lang.Exception
- if an error occurspublic void tearDown() throws java.lang.Exception
tearDown
in class LoggedTestCase
java.lang.Exception
- if an error occursprotected void setDefault(java.lang.String key, java.lang.String value)
key
- property keyvalue
- property valuepublic static boolean hasReasonKey(I18NException ex, java.lang.String reasonKey)
ex
- an I18NException
valuereasonKey
- reason key to be foundkey
of the
reasons
why the exception occured.public static java.io.File getUniqueFilename(java.lang.String prefix, java.lang.String suffix, java.io.File currentDirectory)
<prefix>-yyyy-MM-dd-nr<suffix>
.prefix
- a String
valuesuffix
- a String
valuecurrentDirectory
- the current directorypublic static User createNormalUser(java.lang.String userid, java.util.LinkedList users)
userid
- initial userid where the search for a unique one starts.users
- list of current userspublic static User createNormalUser(java.util.LinkedList users)
unique normal user
with initial name "test_user"
.users
- list of current userspublic static User createDoctorUser(java.util.LinkedList users)
users
- list of current userscreateNormalUser(String, LinkedList)
public static User createAdminUser(java.util.LinkedList users)
users
- list of current userscreateNormalUser(String, LinkedList)
public static User login(BugBaseServletClient client, java.lang.String userid, java.lang.String password) throws I18NException
client
- proxy to the
BugBaseServlet
.userid
- user IDpassword
- user passwordI18NException
- if an error occurspublic static User searchUser(java.lang.String userid, java.util.LinkedList users)
userid
- user ID to be foundusers
- list of usersnull
is returned.public static java.lang.String createUniqueUserId(java.lang.String initial, java.util.LinkedList users)
initial
- start at this user IDusers
- list of users
.public static boolean isUniqueUserId(java.lang.String userid, java.util.LinkedList users)
userid
.userid
- user ID to be checkedusers
- list of users
.true
, if the list does not contain a user with
the given user ID.public BugReport createCompleteBugReport(java.lang.String groupid)
disturbing
groupid
- bug reporter group IDBugReport
valuepublic static BugReport createCompleteBugReport(java.lang.String title, java.lang.String description, java.lang.String packageName, java.lang.String groupid, java.lang.String errorLevel)
title
- see bug report title
description
- bug report description
packageName
- see
see bug report package name
groupid
- see
bug report group id
errorLevel
- see
bug report error level
complete
bug reportpublic com.meterware.httpunit.WebResponse loginPage(User user, com.meterware.httpunit.WebConversation wc, java.lang.String jsp, boolean searchLogin) throws java.lang.Exception
user
- user the login should be executed forwc
- the web conversationjsp
- the JSP that requires a loginsearchLogin
- if true
, the result
page will be searched for a login form. The login form is
recognized
by its action. The action must contain "login.do" as substring.java.lang.Exception
- if an error occurspublic com.meterware.httpunit.WebResponse loginPage(com.meterware.httpunit.WebConversation wc, java.lang.String jsp, boolean searchLogin) throws java.lang.Exception
loginPage()
with normal user
wc
- the web conversationjsp
- the JSP that requires a loginsearchLogin
- if true
, the result
page will be searched for a login form. The login form is
recognized
by its action. The action must contain "login.do" as substring.java.lang.Exception
- if an error occursprotected com.meterware.httpunit.WebResponse callPage(com.meterware.httpunit.WebConversation wc, java.lang.String jsp) throws java.lang.Exception
wc
- the web conversationjsp
- the JSP that requires a loginjava.lang.Exception
- if an error occurspublic com.meterware.httpunit.WebResponse logoffPage(com.meterware.httpunit.WebConversation wc, java.lang.String jsp) throws java.lang.Exception
wc
- the web conversationjsp
- the JSP from where the logoff will be processedjava.lang.Exception
- if an error occursprotected com.meterware.httpunit.WebResponse login(User user, com.meterware.httpunit.WebConversation wc, com.meterware.httpunit.WebResponse resp, boolean searchLogin) throws java.lang.Exception
user
- user the login should be executed forwc
- the current web conversationresp
- the web response, where the input form will be searchedsearchLogin
- if true
, the result
page will be searched for a login form. The login form is
recognized
by its action. The action must contain "login.do" as substring.java.lang.Exception
- if an error occursprotected com.meterware.httpunit.WebResponse logoff(com.meterware.httpunit.WebConversation wc, com.meterware.httpunit.WebResponse resp) throws java.lang.Exception
wc
- the current web conversationresp
- the web response, where the input form will be searchedjava.lang.Exception
- if an error occursprotected com.meterware.httpunit.WebRequest fillReportForm(com.meterware.httpunit.WebForm form, java.lang.String title, java.lang.String description, java.lang.String packageName, java.lang.String groupid, java.lang.String errorLevel)
form
- the HTML formtitle
- bug report titledescription
- bug report descriptionpackageName
- bug report package namegroupid
- bug report group IDerrorLevel
- bug report error levelpublic static com.meterware.httpunit.WebForm findForm(com.meterware.httpunit.WebForm[] forms, java.lang.String action)
forms
- array of form objectsaction
- action string that must be contained in the action string.null
, if the
desired form cannot be found.public static com.meterware.httpunit.WebLink findLink(com.meterware.httpunit.WebLink[] links, java.lang.String reference)
links
- array of link objectsreference
- string that must be contained in the reference string.null
, if the
desired link cannot be found.public static com.meterware.httpunit.WebLink findLinkByText(com.meterware.httpunit.WebLink[] links, java.lang.String reference)
links
- array of link objectsreference
- string that must be contained in the reference string.null
, if the
desired link cannot be found.public User getNormalUser()
public void setNormalUser(User v)
v
- Value to assign to normalUser.public User getDoctorUser()
public void setDoctorUser(User v)
v
- Value to assign to doctorUser.public User getAdminUser()
public void setAdminUser(User v)
v
- Value to assign to adminUser.public java.util.ResourceBundle getResourceBundle()
public void setResourceBundle(java.util.ResourceBundle v)
v
- Value to assign to resourceBundle.public BugBaseServletClient getClient()
public void setClient(BugBaseServletClient v)
v
- Value to assign to client.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |