com.atlassian.confluence
Class AbstractAtlassianWebTestCase

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by com.atlassian.confluence.ThreadLocalWebTestCase
              extended by com.atlassian.confluence.AbstractAtlassianWebTestCase
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
AbstractConfluenceAcceptanceTest

public abstract class AbstractAtlassianWebTestCase
extends ThreadLocalWebTestCase

This super class provides extensions to JWebUnit useful in acceptance tests.


Field Summary
protected  org.slf4j.Logger log
           
static java.lang.String SITE_TITLE_SUFFIX
          Deprecated. since 3.1 use ConfluencePage.SITE_TITLE_SUFFIX
static java.lang.String TITLE_SEPARATOR
          Deprecated. since 3.1 use ConfluencePage.TITLE_SEPARATOR
 
Constructor Summary
AbstractAtlassianWebTestCase()
           
AbstractAtlassianWebTestCase(java.lang.String testName)
           
 
Method Summary
protected  void assertCollectionContainsKeyWithValue(java.util.Collection collection, java.lang.String key, java.lang.String value)
           
protected static void assertContains(java.lang.String expectedSubstring, java.lang.String actual)
           
protected static void assertDoesNotContain(java.lang.String unexpectedSubstring, java.lang.String actual)
           
 void assertElementNotPresentByXPath(java.lang.String string)
          Assert that an element with a given xpath is not present.
 void assertElementPresentByXPath(java.lang.String string)
          Assert that an element with a given xpath is present.
protected static void assertEndsWith(java.lang.String expectedSuffix, java.lang.String actual)
           
 void assertLinkNotPresentWithHrefContaining(java.lang.String urlSubstring)
           
 void assertLinkPresent(java.lang.String linkId)
          Assert that a link with a given id is present in the response.
 void assertLinkPresentWithHref(java.lang.String url)
           
 void assertLinkPresentWithHrefContaining(java.lang.String urlSubstring)
           
 void assertLinkPresentWithImage(java.lang.String imageFileName)
          Assert that a link containing a specified image is present.
 void assertLinkPresentWithText(java.lang.String string)
          Assert that a link containing the supplied text is present.
 void assertLinkPresentWithTextAndHref(java.lang.String text, java.lang.String href)
           
 void assertPageTitleEquals(java.lang.String pageTitle)
          Asserts that the title equals the passed pageTitle plus the site suffix (usually SITE_TITLE_SUFFIX)
e.g.
 void assertServerResponseContains(java.lang.String string)
           
 void assertServerResponseDoesNotContain(java.lang.String string)
           
protected static void assertStartsWith(java.lang.String expectedPrefix, java.lang.String actual)
           
 void assertStatusCode(int expectedStatus)
           
 void assertSubmitButtonNotPresent(java.lang.String buttonName)
          Assert that a submit button with a given name is not present.
 void assertTextInElement(java.lang.String elementID, java.lang.String text)
          Assert that a given element contains specific text.
 void assertTextNotPresent(java.lang.String string)
          Assert that supplied text is not present.
 void assertTextPresent(java.lang.String text)
          Assert that supplied text is present.
 void assertTextPresentInPageSource(java.lang.String text)
          Asserts that the given text is in the page source.
 void assertTextsPresentInOrder(java.lang.String... texts)
          Asserts that all the given texts appear in the current response in the order in which they appear in the array.
 void assertTextsPresentInOrder(java.lang.String[] expected, java.lang.String[] unexpected)
          Asserts that all the given expected texts appear in the current response in the order in which they appear in the array, with none of the unexpected Strings occurring in-between.
 void assertTitleEquals(java.lang.String s)
          Deprecated. Don't use directly, use assertPageTitleEquals(String) or assertTitleEquals(String, String)
 void assertTitleEquals(java.lang.String pageTitle, java.lang.String spaceTitle)
          Asserts that the title equals the passed pageTitle plus separator plus spaceTitle plus site suffix (usually SITE_TITLE_SUFFIX).
 void clickLinkWithText(java.lang.String linkText)
          Navigate by selection of a link containing given text.
protected  java.lang.String getGroupFromResponse(java.lang.String pattern)
           
 void selectOptionByValue(java.lang.String selectName, java.lang.String value)
          Select an option with a given value in a select element.
 void setTextField(java.lang.String inputName, java.lang.String value)
          Set the value of a text or password input field.
 void setTextFieldUnlessBlank(java.lang.String inputName, java.lang.String value)
           
 
Methods inherited from class com.atlassian.confluence.ThreadLocalWebTestCase
assertButtonNotPresent, assertButtonNotPresentWithText, assertButtonPresent, assertButtonPresentWithText, assertCheckboxNotPresent, assertCheckboxNotPresent, assertCheckboxNotSelected, assertCheckboxNotSelected, assertCheckboxPresent, assertCheckboxPresent, assertCheckboxSelected, assertCheckboxSelected, assertCookiePresent, assertCookieValueEquals, assertCookieValueMatch, assertDownloadedFileEquals, assertElementNotPresent, assertElementPresent, assertFormElementEmpty, assertFormElementEquals, assertFormElementMatch, assertFormElementNotPresent, assertFormElementPresent, assertFormNotPresent, assertFormNotPresent, assertFormPresent, assertFormPresent, assertFramePresent, assertHiddenFieldPresent, assertImagePresent, assertImageValid, assertImageValidAndStore, assertKeyInTable, assertKeyInTable, assertKeyNotInTable, assertKeyNotPresent, assertKeyNotPresent, assertKeyPresent, assertKeyPresent, assertKeysInTable, assertKeysInTable, assertLinkNotPresent, assertLinkNotPresentWithExactText, assertLinkNotPresentWithExactText, assertLinkNotPresentWithImage, assertLinkNotPresentWithText, assertLinkNotPresentWithText, assertLinkPresentWithExactText, assertLinkPresentWithExactText, assertLinkPresentWithText, assertMatch, assertMatchInElement, assertMatchInTable, assertMatchInTable, assertNoMatch, assertNoMatchInElement, assertNoMatchInTable, assertNoMatchInTable, assertRadioOptionNotPresent, assertRadioOptionNotSelected, assertRadioOptionPresent, assertRadioOptionSelected, assertResetButtonNotPresent, assertResetButtonNotPresent, assertResetButtonPresent, assertResetButtonPresent, assertSelectedOptionEquals, assertSelectedOptionMatches, assertSelectedOptionsEqual, assertSelectedOptionsMatch, assertSelectedOptionValueEquals, assertSelectedOptionValuesEqual, assertSelectOptionNotPresent, assertSelectOptionPresent, assertSelectOptionsEqual, assertSelectOptionsNotEqual, assertSelectOptionsPresent, assertSelectOptionValueNotPresent, assertSelectOptionValuePresent, assertSelectOptionValuesEqual, assertSelectOptionValuesNotEqual, assertSelectOptionValuesPresent, assertSubmitButtonNotPresent, assertSubmitButtonPresent, assertSubmitButtonPresent, assertSubmitButtonPresent, assertTableEquals, assertTableEquals, assertTableMatch, assertTableMatch, assertTableNotPresent, assertTablePresent, assertTableRowCountEquals, assertTableRowsEqual, assertTableRowsEqual, assertTableRowsMatch, assertTableRowsMatch, assertTextFieldEquals, assertTextInTable, assertTextInTable, assertTextNotInElement, assertTextNotInTable, assertTextNotInTable, assertTitleEqualsKey, assertTitleEqualsKey, assertTitleMatch, assertWindowCountEquals, assertWindowPresent, assertWindowPresent, assertWindowPresentWithTitle, beginAt, checkCheckbox, checkCheckbox, clickButton, clickButtonWithText, clickElementByXPath, clickLink, clickLinkWithExactText, clickLinkWithExactText, clickLinkWithImage, clickLinkWithText, clickRadioOption, closeBrowser, closeWindow, dumpCookies, dumpHtml, dumpHtml, dumpTable, dumpTable, getDialog, getElementAttributByXPath, getElementTextByXPath, getFormElementValue, getImage, getMessage, getMessage, getPageSource, getServeurResponse, getTable, getTestContext, getTester, getTestingEngineKey, gotoFrame, gotoPage, gotoRootWindow, gotoWindow, gotoWindow, gotoWindowByTitle, removeThreadLocal, reset, runBare, saveAs, selectOption, selectOptions, selectOptionsByValues, setDialog, setExpectedJavaScriptAlert, setExpectedJavaScriptAlert, setExpectedJavaScriptConfirm, setExpectedJavaScriptConfirm, setExpectedJavaScriptPrompt, setExpectedJavaScriptPrompt, setFormElement, setScriptingEnabled, setTestContext, setTester, setTestingEngineKey, setWorkingForm, setWorkingForm, setWorkingForm, submit, submit, submit, tearDown, uncheckCheckbox, uncheckCheckbox
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runTest, setName, setUp, 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
 

Field Detail

log

protected final transient org.slf4j.Logger log

TITLE_SEPARATOR

@Deprecated
public static final java.lang.String TITLE_SEPARATOR
Deprecated. since 3.1 use ConfluencePage.TITLE_SEPARATOR
See Also:
Constant Field Values

SITE_TITLE_SUFFIX

@Deprecated
public static final java.lang.String SITE_TITLE_SUFFIX
Deprecated. since 3.1 use ConfluencePage.SITE_TITLE_SUFFIX
See Also:
Constant Field Values
Constructor Detail

AbstractAtlassianWebTestCase

public AbstractAtlassianWebTestCase()

AbstractAtlassianWebTestCase

public AbstractAtlassianWebTestCase(java.lang.String testName)
Method Detail

getGroupFromResponse

protected java.lang.String getGroupFromResponse(java.lang.String pattern)

assertPageTitleEquals

public void assertPageTitleEquals(java.lang.String pageTitle)
Asserts that the title equals the passed pageTitle plus the site suffix (usually SITE_TITLE_SUFFIX)
e.g. "Dashboard - Confluence"

Parameters:
pageTitle - The title displayed before the first separator

assertTitleEquals

public void assertTitleEquals(java.lang.String pageTitle,
                              java.lang.String spaceTitle)
Asserts that the title equals the passed pageTitle plus separator plus spaceTitle plus site suffix (usually SITE_TITLE_SUFFIX).
e.g. "Home - Test Space - Confluence"

Parameters:
pageTitle - The title displayed before the first separator
spaceTitle - The title displayed for the tested space

assertTitleEquals

public void assertTitleEquals(java.lang.String s)
Deprecated. Don't use directly, use assertPageTitleEquals(String) or assertTitleEquals(String, String)

Description copied from class: ThreadLocalWebTestCase
Assert title of current html page in conversation matches an expected value.

Overrides:
assertTitleEquals in class ThreadLocalWebTestCase
Parameters:
s - expected title value

assertCollectionContainsKeyWithValue

protected void assertCollectionContainsKeyWithValue(java.util.Collection collection,
                                                    java.lang.String key,
                                                    java.lang.String value)
                                             throws java.lang.Exception
Throws:
java.lang.Exception

assertTextsPresentInOrder

public void assertTextsPresentInOrder(java.lang.String... texts)
Asserts that all the given texts appear in the current response in the order in which they appear in the array.

Parameters:
texts - an array of strings expected to appear in the response

assertTextsPresentInOrder

public void assertTextsPresentInOrder(java.lang.String[] expected,
                                      java.lang.String[] unexpected)
Asserts that all the given expected texts appear in the current response in the order in which they appear in the array, with none of the unexpected Strings occurring in-between.

Parameters:
expected - an array of strings expected to appear in the response
unexpected - an array of string unexpected to appear in the response

assertTextPresentInPageSource

public void assertTextPresentInPageSource(java.lang.String text)
Asserts that the given text is in the page source. Useful for testing non-html responses where assertTextPresent doesn't work.

Parameters:
text - the text to look for

assertElementPresentByXPath

public void assertElementPresentByXPath(java.lang.String string)
Description copied from class: ThreadLocalWebTestCase
Assert that an element with a given xpath is present.

Overrides:
assertElementPresentByXPath in class ThreadLocalWebTestCase
Parameters:
string - element xpath to test for.

assertTextNotPresent

public void assertTextNotPresent(java.lang.String string)
Description copied from class: ThreadLocalWebTestCase
Assert that supplied text is not present.

Overrides:
assertTextNotPresent in class ThreadLocalWebTestCase

assertElementNotPresentByXPath

public void assertElementNotPresentByXPath(java.lang.String string)
Description copied from class: ThreadLocalWebTestCase
Assert that an element with a given xpath is not present.

Overrides:
assertElementNotPresentByXPath in class ThreadLocalWebTestCase
Parameters:
string - element xpath to test for.

assertLinkPresentWithText

public void assertLinkPresentWithText(java.lang.String string)
Description copied from class: ThreadLocalWebTestCase
Assert that a link containing the supplied text is present.

Overrides:
assertLinkPresentWithText in class ThreadLocalWebTestCase

assertLinkPresentWithImage

public void assertLinkPresentWithImage(java.lang.String imageFileName)
Description copied from class: ThreadLocalWebTestCase
Assert that a link containing a specified image is present.

Overrides:
assertLinkPresentWithImage in class ThreadLocalWebTestCase
Parameters:
imageFileName - A suffix of the image's filename; for example, to match "images/my_icon.png", you could just pass in "my_icon.png".

assertLinkPresent

public void assertLinkPresent(java.lang.String linkId)
Description copied from class: ThreadLocalWebTestCase
Assert that a link with a given id is present in the response.

Overrides:
assertLinkPresent in class ThreadLocalWebTestCase

assertTextPresent

public void assertTextPresent(java.lang.String text)
Description copied from class: ThreadLocalWebTestCase
Assert that supplied text is present.

Overrides:
assertTextPresent in class ThreadLocalWebTestCase

assertTextInElement

public void assertTextInElement(java.lang.String elementID,
                                java.lang.String text)
Description copied from class: ThreadLocalWebTestCase
Assert that a given element contains specific text.

Overrides:
assertTextInElement in class ThreadLocalWebTestCase
Parameters:
elementID - id of element to be inspected.
text - to check for.

assertSubmitButtonNotPresent

public void assertSubmitButtonNotPresent(java.lang.String buttonName)
Description copied from class: ThreadLocalWebTestCase
Assert that a submit button with a given name is not present.
A submit button can be the following HTML elements:

Overrides:
assertSubmitButtonNotPresent in class ThreadLocalWebTestCase

selectOptionByValue

public void selectOptionByValue(java.lang.String selectName,
                                java.lang.String value)
Description copied from class: ThreadLocalWebTestCase
Select an option with a given value in a select element.

Overrides:
selectOptionByValue in class ThreadLocalWebTestCase
Parameters:
selectName - name of select element.

clickLinkWithText

public void clickLinkWithText(java.lang.String linkText)
Description copied from class: ThreadLocalWebTestCase
Navigate by selection of a link containing given text.

Overrides:
clickLinkWithText in class ThreadLocalWebTestCase
Parameters:
linkText - Text in the link.

assertLinkPresentWithHref

public void assertLinkPresentWithHref(java.lang.String url)

assertLinkPresentWithHrefContaining

public void assertLinkPresentWithHrefContaining(java.lang.String urlSubstring)

assertLinkNotPresentWithHrefContaining

public void assertLinkNotPresentWithHrefContaining(java.lang.String urlSubstring)

assertLinkPresentWithTextAndHref

public void assertLinkPresentWithTextAndHref(java.lang.String text,
                                             java.lang.String href)

setTextFieldUnlessBlank

public void setTextFieldUnlessBlank(java.lang.String inputName,
                                    java.lang.String value)

setTextField

public void setTextField(java.lang.String inputName,
                         java.lang.String value)
Description copied from class: ThreadLocalWebTestCase
Set the value of a text or password input field.

Overrides:
setTextField in class ThreadLocalWebTestCase
Parameters:
inputName - name of form element.
value - value to set.

assertStatusCode

public void assertStatusCode(int expectedStatus)

assertServerResponseContains

public void assertServerResponseContains(java.lang.String string)

assertServerResponseDoesNotContain

public void assertServerResponseDoesNotContain(java.lang.String string)

assertContains

protected static void assertContains(java.lang.String expectedSubstring,
                                     java.lang.String actual)

assertDoesNotContain

protected static void assertDoesNotContain(java.lang.String unexpectedSubstring,
                                           java.lang.String actual)

assertEndsWith

protected static void assertEndsWith(java.lang.String expectedSuffix,
                                     java.lang.String actual)

assertStartsWith

protected static void assertStartsWith(java.lang.String expectedPrefix,
                                       java.lang.String actual)


Copyright © 2003-2010 Atlassian. All Rights Reserved.