Class ModuleTestBase
- All Implemented Interfaces:
junit.framework.Test
Look at Automated testing with OpenXava.
- Author:
- Javier Paniza
-
Constructor Summary
ConstructorsConstructorDescriptionModuleTestBase(String module) Constructor for JUnit 4 style tests.ModuleTestBase(String nameTest, String module) To test the specified module of the default application.ModuleTestBase(String nameTest, String application, String module) To test the specified module of the specified application. -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean_collectionHasFilterHeader(String collection) protected voidassertAction(String action) protected voidassertAction(String action, String arguments) protected voidassertActions(String[] expectedActions) protected voidprotected voidassertAllCollectionChecked(String collection) protected voidassertAllCollectionUnchecked(String collection) protected voidassertAllGroupBys(String... expectedTitles) protected voidprotected voidassertCollectionColumnCount(String collection, int expected) protected voidassertCollectionNotEmpty(String collection) protected voidassertCollectionRowCount(String collection, int expectedCount) Row count displayed with data.protected voidassertContentType(String type) Util for web applications, but using it make the test web dependent.protected voidassertContentTypeForPopup(int popup, String type) Util for web applications, but using it makes the test web dependent.protected voidUtil for web applications, but using it makes the test web dependent.protected voidassertDescriptionValue(String name, String value) protected voidprotected voidassertDialogTitle(String expectedTitle) protected voidassertDiscussionCommentContentText(String name, int row, String expectedText) Assert the content of a comment of DISCUSSION property as text, just the content of the comment excluding header data.protected voidassertDiscussionCommentsCount(String name, int expectedCount) Assert the amount of comments in a DISCUSSION property.protected voidassertDiscussionCommentText(String name, int row, String extendedText) Assert the content of a comment of DISCUSSION property as text, including header data like user and date.protected voidassertEditable(String name) protected voidassertEditableInCollection(String collection, int row, int column) protected voidassertEditableInCollection(String collection, int row, String name) protected voidassertEditableInList(int row, int column) Asserts that a property in a specific row and column of the list is editable.protected voidassertEditableInList(int row, String name) Asserts that a property in a specific row of the list is editable.protected voidassertError(String message) protected voidassertErrorsCount(int expectedCount) protected voidassertExists(String name) protected voidassertFile(String property) Assert if the property with an upload editor has a file associated.protected voidassertFile(String property, int index, String expectedType) Assert if the property with an upload editor with multiple files has a file associated in certain position.protected voidassertFile(String property, String contentType) Assert if the property with an upload editor of has a file associated.protected voidassertFilesCount(String property, int expectedCount) Assert the amount of files in a property with an upload multiple editor.protected voidassertFocusOn(String name) protected voidassertInfo(String message) protected voidassertInfosCount(int expectedCount) protected voidassertLabel(int sectionIndex, String expectedLabel) protected voidassertLabel(String name, String expectedLabel) protected voidassertLabelInCollection(String collection, int column, String label) protected voidassertLabelInList(int column, String label) protected voidassertListAllConfigurations(String... expectedTitles) protected voidassertListColumnCount(int expected) protected voidprotected voidassertListRowCount(int expected) Rows count displayed with data.protected voidassertListSelectedConfiguration(String expectedTitle) protected voidassertListTitle(String expectedTitle) protected voidassertMessage(String message) protected voidassertMessagesCount(int expectedCount) protected voidassertNoAction(String action) protected voidassertNoAction(String action, String arguments) protected voidprotected voidassertNoEditable(String name) protected voidassertNoEditableInCollection(String collection, int row, int column) protected voidassertNoEditableInCollection(String collection, int row, String name) protected voidassertNoEditableInList(int row, int column) Asserts that a property in a specific row and column of the list is NOT editable.protected voidassertNoEditableInList(int row, String name) Asserts that a property in a specific row of the list is NOT editable.protected voidassertNoError(String message) protected voidprotected voidassertNoFile(String property) Assert if the property with an upload editor has not a file associated.protected voidassertNoInfo(String message) protected voidprotected voidassertNoLabel(String name) protected voidprotected voidassertNoMessage(String message) protected voidprotected voidprotected voidassertNoRowStyleInCollection(String collection, int row) protected voidassertNoRowStyleInList(int row) protected voidassertNotEquals(String msg, String value1, String value2) protected voidassertNotExists(String name) protected voidassertNoWarning(String message) protected voidprotected voidassertPopupCount(int count) protected voidassertPopupPDFLine(int lineNumber, String expectedContent) Assert the value for the specified line as text of PDF in the popup window.protected voidassertPopupPDFLinesCount(int expectedCount) Assert the count of lines of the PDF in the popup window.protected voidassertRowChecked(int row) protected voidassertRowCollectionChecked(String collection, int row) protected voidassertRowCollectionUnchecked(String collection, int row) protected voidassertRowsChecked(int[] rows) protected voidassertRowsChecked(int f1, int f2) protected voidassertRowStyleInCollection(String collection, int row, String expectedStyle) protected voidassertRowStyleInList(int row, String expectedStyle) protected voidassertRowUnchecked(int row) protected voidassertTotalInCollection(String collection, int row, int column, String total) protected voidassertTotalInCollection(String collection, int column, String total) protected voidassertTotalInCollection(String collection, int row, String name, String total) protected voidassertTotalInCollection(String collection, String name, String total) protected voidassertTotalInList(int column, String total) protected voidassertTotalInList(String name, String total) protected voidassertValidValueExists(String name, String key, String description) protected voidassertValidValueNotExists(String name, String key) protected voidassertValidValues(String name, String[][] values) protected voidassertValidValuesCount(String name, int count) protected voidassertValidValuesCountInCollection(String collection, int row, String name, int count) protected voidassertValidValuesInCollection(String collection, int row, String name, String[][] values) protected voidassertValue(String name, String value) protected voidassertValue(String model, String name, String value) protected voidassertValueIgnoringCase(String name, String value) protected voidassertValueInCollection(String collection, int row, int column, String value) protected voidassertValueInCollection(String collection, int row, String name, String value) protected voidassertValueInCollectionIgnoringCase(String collection, int row, int column, String value) protected voidassertValueInList(int row, int column, String value) protected voidassertValueInList(int row, String value) protected voidassertValueInList(int row, String name, String value) protected voidassertValues(String name, String[] values) For multiple values property.protected voidassertValuesInList(int row, String... values) protected voidassertWarning(String message) protected voidassertWarningsCount(int expectedCount) protected voidchangeModule(String module) protected voidchangeModule(String application, String module) protected voidcheckAll()protected voidcheckAllCollection(String collection) protected voidcheckRow(int row) protected voidprotected voidcheckRowCollection(String collection, int row) protected voidprotected voidprotected org.htmlunit.WebClientIt creates and returns a new WebClient each time you call it.protected StringdecorateId(String name) Decorate the name to produced an unique identifier as the used by OX for HTML elements.protected voidExecute the action clicking in the link or button.protected voidprotected voidexecuteClicking(String action, String arguments) Deprecated.Since 7.2 the regular execute() uses clicking always, so you can use execute() insteadprotected voidprotected booleanexistsAction(String action) protected org.htmlunit.BrowserVersionThe browser emulation used for the test.protected intgetCollectionColumnCount(String collection) protected intgetCollectionRowCount(String collection) Row count displayed with data.protected Stringprotected StringgetDescriptionValue(String name) In the case of combo (descriptionsEditor.jsp) (or his read only version) the value that is visualized to user.protected StringgetDiscussionCommentContentText(String name, int row) Get the content of a comment of DISCUSSION property as text, just the content of the comment excluding header data.protected StringgetDiscussionCommentText(String name, int row) Get the content of a comment of DISCUSSION property as text, including header data like user and date.protected org.htmlunit.html.HtmlFormgetForm()Current HtmlForm (of HtmlUnit).protected static StringgetHost()protected StringgetHtml()Current HTML code.protected org.htmlunit.html.HtmlPageThis allows you testing using HtmlUnit APIs directly.protected String[]getKeysValidValues(String name) protected Stringprotected intprotected intRows count displayed with data.protected Stringprotected StringThe first messageprotected Stringprotected InputStreamThe content of the response for popup window.protected StringThe content of the PDF in the popup window as text.protected StringgetPopupPDFLine(int lineNumber) The specified line as text of PDF in the popup window.protected intThe count of lines of the PDF in the popup window.protected intNumber of pages of the PDF in the popup windowprotected StringThe text of the response for popup window.protected static StringgetPort()protected StringgetText()The text of the response.protected Stringprotected StringDeprecated.The model is automatically deduced, so you can use just getValue(String name)protected StringgetValueInCollection(String collection, int row, int column) protected StringgetValueInCollection(String collection, int row, String name) protected StringgetValueInList(int row) protected StringgetValueInList(int row, int column) protected StringgetValueInList(int row, String name) protected String[]For properties with multiple valuesprotected org.htmlunit.WebClientThis allows you testing using HtmlUnit APIs directly.static StringFrom file xava-junit.propertiesstatic StringgetXavaJUnitProperty(String id, String defaultValue) From file xava-junit.propertiesprotected voidprotected voidlogout()User logout.protected voidMove an element of collection from a row to another.protected voidMove an element of collection from a row to another.protected voidpostDiscussionComment(String name, String commentContent) Post a new comment into a DISCUSSION property.protected voidOnly for debug.protected voidOnly for debug.protected voidreload()Like clicking on the reload button of the browser.protected voidremoveFile(String property) Remove the current file from a property with an upload editor.protected voidremoveFile(String property, int index) Remove a file from a property with an upload multiple editor.protected voidLike close navigator, open again, and reexecute the module.protected voidselectGroupBy(String title) protected voidselectListConfiguration(String title) protected voidselectModuleInPage(String module) protected voidsetConditionComparators(String... values) protected voidsetConditionComparators(String collection, String[] values) protected voidsetConditionComparators(List values) To be used from Groovy, that does not work with setConditionComparators(String ... values).protected voidsetConditionValues(String... values) protected voidsetConditionValues(String collection, String[] values) protected voidsetConditionValues(List values) To be used from Groovy, that does not work with setConditionValues(String ... values).protected voidsetConditionValuesTo(String... values) protected voidsetFileValue(String name, String filePath) protected voidprotected voidDeprecated.Now the model is deduced automaticallyprotected voidDeprecated.Now this is done automaticallyprotected voidsetUp()protected voidprotected voidDeprecated.Now model is deduced automatically, so you can use setValue(String model, String value)protected voidsetValueInCollection(String collection, int row, int column, String value) protected voidsetValueInCollection(String collection, int row, String name, String value) protected voidsetValueInList(int row, int column, String value) Sets the value of a property in a specific row and column of the list.protected voidsetValueInList(int row, String name, String value) Sets the value of a property in a specific row of the list.protected voidsetValueNotNotify(String name, String value) protected voidFor multiple values propertiesprotected voidtearDown()protected StringtoKeyString(Object pojo) Returns a string representations of the key of a POJO from the POJO itself.protected voidprotected voiduncheckAllCollection(String collection) protected voiduncheckRow(int row) protected voiduncheckRowCollection(String collection, int row) protected voiduploadFile(String property, String fileURL) Upload a file in a property with an upload editor.protected voidwaitAJAX()Wait until the current AJAX request is done and update the page if needed.Methods inherited from class junit.framework.TestCase
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, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, toString
-
Constructor Details
-
ModuleTestBase
To test the specified module of the specified application.You can send
nullfornullin such a case you must usechangeModule(java.lang.String)at the very first of your test methods. -
ModuleTestBase
To test the specified module of the default application.In this case the application is obtained from the
applicationproperty inxava-junit.propertiesfile.
You can sendnullfornullin such a case you must usechangeModule(java.lang.String)at the very first of your test methods. -
ModuleTestBase
Constructor for JUnit 4 style tests.The module must be set in the subclass constructor by calling the appropriate constructor with module parameter.
- Since:
- 7.6.2
-
-
Method Details
-
setUp
- Overrides:
setUpin classjunit.framework.TestCase- Throws:
Exception
-
tearDown
- Overrides:
tearDownin classjunit.framework.TestCase- Throws:
Exception
-
login
- Throws:
Exception
-
logout
User logout.- Throws:
Exception
-
resetModule
Like close navigator, open again, and reexecute the module.- Throws:
Exception
-
getBrowserVersion
The browser emulation used for the test.If you overwrite this method maybe some methods of ModuleTestBase would not work correctly. Usually you overwrite it to test using directly the HtmlUnit API.
The use of this method is discouraged because binds your test to a HTML implementation. Before to use this method look for another more abstract method in this class.- Throws:
Exception- Since:
- 5.5
-
reload
Like clicking on the reload button of the browser.- Throws:
Exception- Since:
- 4.1.2
-
selectModuleInPage
- Throws:
Exception
-
changeModule
- Throws:
Exception
-
changeModule
- Throws:
Exception
-
getModuleURL
- Throws:
XavaException
-
setModel
Deprecated.Now the model is deduced automaticallyThe model used as prefix to method like getValue, assertValue, etc.By default is the model of module. The effect of the this setting is only for the life of one test.
-
setModelToModuleSetting
protected void setModelToModuleSetting()Deprecated.Now this is done automaticallyPut the model of the module as the default model of the test.This is the default setting, hence this method is called to restore the original setting.
-
execute
Execute the action clicking in the link or button.- Throws:
Exception
-
waitAJAX
Wait until the current AJAX request is done and update the page if needed.Usually is only needed to call this method when you use directly HtmlUnit APIs.
- Throws:
Exception- Since:
- 5.7
-
decorateId
Decorate the name to produced an unique identifier as the used by OX for HTML elements. -
assertFocusOn
- Throws:
Exception
-
executeClicking
Deprecated.Since 7.2 the regular execute() uses clicking always, so you can use execute() insteadExecutes an action simulating a real click in the button or link.In addition to execute the action this method throws the corresponding events of clicking the real link, like the focus lost of the current editor, for example.
- Throws:
Exception
-
execute
- Throws:
Exception
-
executeDefaultAction
- Throws:
Exception
-
assertExists
- Throws:
Exception
-
assertNotExists
- Throws:
Exception
-
getDescriptionValue
In the case of combo (descriptionsEditor.jsp) (or his read only version) the value that is visualized to user.- Returns:
- Throws:
Exception
-
getValue
- Throws:
Exception
-
getValues
For properties with multiple values- Throws:
Exception
-
getLabel
- Throws:
Exception
-
getValue
Deprecated.The model is automatically deduced, so you can use just getValue(String name)In case we does not work with main view.- Throws:
Exception
-
printHtml
Only for debug.- Throws:
Exception
-
assertContentType
Util for web applications, but using it make the test web dependent.- Parameters:
type- text/html, application/pdf, etc.
-
assertContentTypeForPopup
Util for web applications, but using it makes the test web dependent.- Parameters:
popup- The window numbertype- text/html, application/pdf, etc.- Since:
- 4.3
-
assertContentTypeForPopup
Util for web applications, but using it makes the test web dependent.- Parameters:
type- text/html, application/pdf, etc.
-
assertPopupCount
- Throws:
Exception- Since:
- 4.3
-
assertNoPopup
- Throws:
Exception
-
getHtml
Current HTML code.It is not very advisable because this will cause dependency to HTML and it will be difficult migrate to another presentation technology.
- Throws:
Exception
-
getText
The text of the response.- Throws:
IOException
-
getPopupText
The text of the response for popup window.- Throws:
Exception
-
getPopupContentAsStream
The content of the response for popup window.- Throws:
Exception- Since:
- 6.4.2
-
getPopupPDFAsText
The content of the PDF in the popup window as text.- Throws:
Exception- Since:
- 4.6
-
printPopupPDFAsText
Only for debug.- Throws:
Exception- Since:
- 4.6
-
getPopupPDFPageCount
Number of pages of the PDF in the popup window- Throws:
Exception- Since:
- 5.0
-
getPopupPDFLine
The specified line as text of PDF in the popup window.- Throws:
Exception- Since:
- 4.6
-
assertPopupPDFLine
Assert the value for the specified line as text of PDF in the popup window.- Throws:
Exception- Since:
- 4.6
-
assertPopupPDFLinesCount
Assert the count of lines of the PDF in the popup window.- Throws:
Exception- Since:
- 4.6
-
getPopupPDFLinesCount
The count of lines of the PDF in the popup window.- Throws:
Exception- Since:
- 4.6
-
setConditionValues
- Parameters:
Varargs- since 4m5.- Throws:
Exception
-
setConditionValuesTo
- Throws:
Exception- Since:
- 4.4
-
setConditionValues
To be used from Groovy, that does not work with setConditionValues(String ... values).- Throws:
Exception- Since:
- 4.0.1
-
setConditionComparators
To be used from Groovy, that does not work with setConditionComparators(String ... values).- Throws:
Exception- Since:
- 4.0.1
-
clearCondition
- Throws:
Exception- Since:
- 5.6
-
setConditionComparators
- Parameters:
values- varargs since 4m5- Throws:
Exception
-
setConditionValues
- Throws:
Exception
-
setConditionComparators
- Throws:
Exception
-
setValueNotNotify
- Throws:
Exception
-
setValue
- Throws:
Exception
-
setValues
For multiple values properties- Throws:
Exception
-
setFileValue
- Throws:
Exception
-
setValue
Deprecated.Now model is deduced automatically, so you can use setValue(String model, String value)In case we do not work with main view.- Throws:
Exception
-
assertLabel
- Throws:
Exception
-
assertLabel
- Throws:
Exception- Since:
- 6.4
-
assertNoLabel
- Throws:
Exception
-
assertValue
- Throws:
Exception
-
assertValues
For multiple values property.- Throws:
Exception
-
assertValueIgnoringCase
- Throws:
Exception
-
assertValue
- Throws:
Exception
-
assertDescriptionValue
- Throws:
Exception
-
existsAction
- Throws:
Exception
-
assertAction
- Throws:
Exception
-
assertAction
- Throws:
Exception
-
assertNoAction
- Throws:
Exception
-
assertNoAction
- Throws:
Exception
-
assertActions
- Throws:
Exception
-
getValueInList
- Throws:
Exception
-
getValueInList
- Throws:
Exception
-
getValueInList
- Throws:
Exception- Since:
- 5.7
-
getValueInCollection
- Throws:
Exception
-
setValueInList
Sets the value of a property in a specific row of the list. This method allows you to modify the value of a property directly in the list view, simulating the user editing the cell in-place. Works with properties that are configured as editable in the list. For reference properties using @DescriptionsList, note that even though the list displays the description or name of the reference, when setting a value you must use the key property of the reference. For example, if you have a family reference that shows descriptions in the list, you would read the value using family.description but set it using family.number. Example:// Simple property setValueInList(0, "unitPrice", "17.00"); // Sets the first row's unitPrice to 17.00 // Reference property with @DescriptionsList assertValueInList(1, "family.description", "HARDWARE"); // Reading shows the description setValueInList(1, "family.number", "3"); // Setting uses the key property // Reference property with multiple keys Warehouse warehouse = new Warehouse(); warehouse.setZoneNumber(4); warehouse.setNumber(13); setValueInList(1, "warehouse.KEY", toKeyString(warehouse)); // For composite keys
- Parameters:
row- The row number (0-based) in the listname- The property name to set, can be a simple property or a qualified property (e.g. "family.number")value- The value to set for the property- Throws:
Exception- Since:
- 7.6
-
setValueInList
Sets the value of a property in a specific row and column of the list. This method allows you to modify the value of a property directly in the list view by specifying the column index instead of the property name. The column index corresponds to the order of properties displayed in the list. Example:setValueInList(0, 2, "17.00"); // Sets the first row's third column to 17.00
- Parameters:
row- The row number (0-based) in the listcolumn- The column number (0-based) in the listvalue- The value to set for the property- Throws:
Exception- Since:
- 7.6
-
assertEditableInList
Asserts that a property in a specific row of the list is editable. This method verifies that a property in the list can be edited in-place by the user. It fails the test if the property is not editable in the specified row. Example:assertEditableInList(0, "unitPrice"); // Verifies the unitPrice in first row is editable assertEditableInList(1, "family.description"); // Verifies a reference property is editable
- Parameters:
row- The row number (0-based) in the listname- The property name to check, can be a simple property or a qualified property- Throws:
Exception- If the property is not editable or if any error occurs during verification- Since:
- 7.6
-
assertNoEditableInList
Asserts that a property in a specific row of the list is NOT editable. This method verifies that a property in the list cannot be edited in-place by the user. It fails the test if the property is editable in the specified row when it should not be. Example:assertNoEditableInList(0, "extendedDescription"); // Verifies the property is not editable assertNoEditableInList(1, "id"); // Verifies a key property is not editable
This is particularly useful for testing properties that should be read-only in the list, such as calculated fields, formula properties, or properties explicitly excluded from the editable properties configuration.- Parameters:
row- The row number (0-based) in the listname- The property name to check, can be a simple property or a qualified property- Throws:
Exception- If the property is editable or if any error occurs during verification- Since:
- 7.6
-
assertEditableInList
Asserts that a property in a specific row and column of the list is editable. This method verifies that a property in the list can be edited in-place by the user, using column index instead of property name. The column index corresponds to the order of properties displayed in the list. Example:assertEditableInList(0, 2); // Verifies the third column in first row is editable
- Parameters:
row- The row number (0-based) in the listcolumn- The column number (0-based) in the list- Throws:
Exception- If the property is not editable or if any error occurs during verification- Since:
- 7.6
-
assertNoEditableInList
Asserts that a property in a specific row and column of the list is NOT editable. This method verifies that a property in the list cannot be edited in-place by the user, using column index instead of property name. It fails the test if the property is editable in the specified row and column when it should not be. Example:assertNoEditableInList(0, 3); // Verifies the fourth column in first row is not editable
This is particularly useful for testing properties that should be read-only in the list, such as calculated fields, formula properties, or properties explicitly excluded from the editable properties configuration.- Parameters:
row- The row number (0-based) in the listcolumn- The column number (0-based) in the list- Throws:
Exception- If the property is editable or if any error occurs during verification- Since:
- 7.6
-
setValueInCollection
protected void setValueInCollection(String collection, int row, String name, String value) throws Exception - Throws:
Exception- Since:
- 5.0
-
setValueInCollection
protected void setValueInCollection(String collection, int row, int column, String value) throws Exception - Throws:
Exception- Since:
- 5.0
-
getValueInCollection
- Throws:
Exception
-
assertRowStyleInList
- Throws:
Exception
-
assertRowStyleInCollection
protected void assertRowStyleInCollection(String collection, int row, String expectedStyle) throws Exception - Throws:
Exception
-
assertNoRowStyleInList
- Throws:
Exception
-
assertNoRowStyleInCollection
- Throws:
Exception
-
_collectionHasFilterHeader
- Throws:
Exception
-
getListRowCount
Rows count displayed with data.Exclude heading and footing, and the not displayed data (maybe in cache).
- Throws:
Exception
-
getListColumnCount
- Throws:
Exception
-
getCollectionColumnCount
- Throws:
Exception
-
getCollectionRowCount
Row count displayed with data.Excludes heading and footing, and not displayed data (but cached).
- Throws:
Exception
-
assertCollectionRowCount
Row count displayed with data.Excludes heading and footing, and not displayed data (but cached).
- Throws:
Exception
-
assertListRowCount
Rows count displayed with data.Exclude headers and footing, and the not displayed data (maybe cached).
- Throws:
Exception
-
assertListColumnCount
- Throws:
Exception
-
assertCollectionColumnCount
- Throws:
Exception
-
assertValueInList
- Throws:
Exception
-
assertValueInList
- Throws:
Exception- Since:
- 5.7
-
assertValuesInList
- Throws:
Exception- Since:
- 5.8
-
assertValueInList
- Throws:
Exception
-
assertValueInCollection
protected void assertValueInCollection(String collection, int row, String name, String value) throws Exception - Throws:
Exception
-
assertValueInCollection
protected void assertValueInCollection(String collection, int row, int column, String value) throws Exception - Throws:
Exception
-
assertValueInCollectionIgnoringCase
protected void assertValueInCollectionIgnoringCase(String collection, int row, int column, String value) throws Exception - Throws:
Exception
-
assertLabelInCollection
protected void assertLabelInCollection(String collection, int column, String label) throws Exception - Throws:
Exception
-
assertLabelInList
- Throws:
Exception
-
assertTotalInList
- Throws:
Exception- Since:
- 4.1
-
assertTotalInList
- Throws:
Exception- Since:
- 4.1
-
assertTotalInCollection
protected void assertTotalInCollection(String collection, int column, String total) throws Exception - Throws:
Exception- Since:
- 4.1
-
assertTotalInCollection
protected void assertTotalInCollection(String collection, int row, int column, String total) throws Exception - Throws:
Exception- Since:
- 4.1
-
assertTotalInCollection
protected void assertTotalInCollection(String collection, String name, String total) throws Exception - Throws:
Exception- Since:
- 4.1
-
assertTotalInCollection
protected void assertTotalInCollection(String collection, int row, String name, String total) throws Exception - Throws:
Exception- Since:
- 4.3
-
checkRow
- Throws:
Exception
-
checkAll
- Throws:
Exception
-
uncheckRow
- Throws:
Exception
-
uncheckAll
- Throws:
Exception
-
checkRowCollection
- Throws:
Exception
-
checkAllCollection
- Throws:
Exception
-
uncheckAllCollection
- Throws:
Exception
-
uncheckRowCollection
- Throws:
Exception
-
checkRow
- Throws:
Exception
-
assertRowChecked
protected void assertRowChecked(int row) -
assertAllChecked
protected void assertAllChecked() -
assertRowCollectionChecked
- Throws:
Exception
-
assertAllCollectionChecked
- Throws:
Exception
-
assertRowsChecked
protected void assertRowsChecked(int f1, int f2) -
assertRowsChecked
protected void assertRowsChecked(int[] rows) -
assertRowUnchecked
protected void assertRowUnchecked(int row) -
assertAllUnchecked
protected void assertAllUnchecked() -
assertRowCollectionUnchecked
- Throws:
Exception
-
assertAllCollectionUnchecked
- Throws:
Exception
-
assertError
- Throws:
Exception
-
assertMessage
- Throws:
Exception
-
assertInfo
- Throws:
Exception- Since:
- 4.3
-
assertWarning
- Throws:
Exception- Since:
- 4.3
-
assertErrorsCount
- Throws:
Exception
-
assertMessagesCount
- Throws:
Exception
-
assertInfosCount
- Throws:
Exception- Since:
- 4.3
-
assertWarningsCount
- Throws:
Exception- Since:
- 4.3
-
assertNoError
- Throws:
Exception
-
assertNoMessage
- Throws:
Exception
-
assertNoInfo
- Throws:
Exception- Since:
- 4.3
-
assertNoWarning
- Throws:
Exception- Since:
- 4.3
-
getMessage
The first message- Throws:
Exception
-
assertNoErrors
- Throws:
Exception
-
assertNoMessages
- Throws:
Exception
-
assertNoWarnings
- Throws:
Exception- Since:
- 5.4
-
assertNoInfos
- Throws:
Exception- Since:
- 5.4
-
assertValidValuesInCollection
protected void assertValidValuesInCollection(String collection, int row, String name, String[][] values) throws Exception - Throws:
Exception- Since:
- 5.1
-
assertValidValuesCountInCollection
protected void assertValidValuesCountInCollection(String collection, int row, String name, int count) throws Exception - Throws:
Exception- Since:
- 5.1
-
assertValidValueNotExists
- Throws:
Exception
-
assertValidValues
- Throws:
Exception
-
assertValidValuesCount
- Throws:
Exception
-
getKeysValidValues
- Throws:
Exception
-
assertEditable
- Throws:
Exception
-
assertNoEditable
- Throws:
Exception
-
assertEditableInCollection
- Throws:
Exception- Since:
- 5.0
-
assertNoEditableInCollection
protected void assertNoEditableInCollection(String collection, int row, String name) throws Exception - Throws:
Exception- Since:
- 5.0
-
assertEditableInCollection
- Throws:
Exception- Since:
- 5.0
-
assertNoEditableInCollection
protected void assertNoEditableInCollection(String collection, int row, int column) throws Exception - Throws:
Exception- Since:
- 5.0
-
assertListTitle
- Throws:
Exception
-
assertNoListTitle
- Throws:
Exception
-
assertListNotEmpty
- Throws:
Exception
-
assertCollectionNotEmpty
- Throws:
Exception
-
assertValidValueExists
- Throws:
Exception- Since:
- 5.3
-
getPort
-
getHost
-
getContextPath
- Since:
- 6.3
-
getXavaJUnitProperty
From file xava-junit.properties- Since:
- 4m6 Before it was called getProperty()
-
getXavaJUnitProperty
From file xava-junit.properties- Since:
- 4m6 Before it was called getProperty()
-
getForm
protected org.htmlunit.html.HtmlForm getForm()Current HtmlForm (of HtmlUnit).This allow you to access directly to html form elements, but it is not very advisable because this will cause dependency to HTML and HtmlUnit so it will be difficult migrate to another presentation technology.
-
getWebClient
protected org.htmlunit.WebClient getWebClient()This allows you testing using HtmlUnit APIs directly.The use of this method is discoraged because binds your test to a HTML implementation. Before to use this method look for another more abstract method in this class.
By default CSS is disabled for performance, if you need that CSS works for your test, write this line:getWebClient().setCssEnabled(true);
-
createWebClient
It creates and returns a new WebClient each time you call it.Also, it's the method used to create the WebClient used for the test, so you can overwrite it to refine the WebClient used for your test.
This allows you testing using HtmlUnit APIs directly.
The use of this method is discoraged because binds your test to a HTML implementation. Before to use this method look for another more abstract method in this class.
By default CSS is disabled for performance, if you need that CSS works for your test, write this line:WebClient webClient = createWebClient(); webClient.setCssEnabled(true);
- Throws:
Exception- Since:
- 7.3
-
getLocale
-
setLocale
- Throws:
Exception
-
toKeyString
Returns a string representations of the key of a POJO from the POJO itself.Useful for obtaining the value to put into a combo (a descriptions list) from a POJO object.
- Throws:
Exception
-
assertNotEquals
-
assertDialog
- Throws:
Exception- Since:
- 4m1
-
assertNoDialog
- Throws:
Exception- Since:
- 4m1
-
closeDialog
- Throws:
Exception- Since:
- 4m1
-
assertDialogTitle
- Throws:
Exception- Since:
- 4m1
-
getHtmlPage
protected org.htmlunit.html.HtmlPage getHtmlPage()This allows you testing using HtmlUnit APIs directly.The use of this method is discouraged because binds your test to a HTML implementation. Before to use this method look for another more abstract method in this class.
- Since:
- 4m4
-
assertDiscussionCommentText
Assert the content of a comment of DISCUSSION property as text, including header data like user and date.- Since:
- 5.6
-
getDiscussionCommentText
Get the content of a comment of DISCUSSION property as text, including header data like user and date.- Since:
- 5.7
-
getDiscussionCommentContentText
Get the content of a comment of DISCUSSION property as text, just the content of the comment excluding header data.- Since:
- 5.7
-
assertDiscussionCommentContentText
Assert the content of a comment of DISCUSSION property as text, just the content of the comment excluding header data.- Since:
- 5.7
-
assertDiscussionCommentsCount
Assert the amount of comments in a DISCUSSION property.- Since:
- 5.6
-
postDiscussionComment
Post a new comment into a DISCUSSION property.- Throws:
Exception- Since:
- 5.6
-
selectListConfiguration
- Throws:
Exception- Since:
- 5.6
-
assertListSelectedConfiguration
- Since:
- 5.6
-
assertListAllConfigurations
- Throws:
Exception- Since:
- 5.6
-
selectGroupBy
- Throws:
Exception- Since:
- 5.8
-
assertAllGroupBys
- Throws:
Exception- Since:
- 5.8
-
assertFile
Assert if the property with an upload editor of has a file associated. For properties with stereotypes IMAGE, PHOTO, FILE, etc. Example:assertFile("photo", "image");It tries to recover the file from the server and verify if it is of contentType.- Parameters:
property- The property name of the current view with an upload editorcontentType- The content type, such as image, image/png, text/html, etc.- Throws:
Exception- Since:
- 6.2
-
assertFile
Assert if the property with an upload editor has a file associated. For properties with stereotypes IMAGE, PHOTO, FILE, etc. Example:assertFile("photo");It tries to recover the file from the server.- Parameters:
property- The property name of the current view with an upload editor- Throws:
Exception- Since:
- 6.2
-
assertFile
Assert if the property with an upload editor with multiple files has a file associated in certain position. For properties with stereotypes IMAGES_GALLERY, FILES, etc. Example:assertFile("attachments", 2, "text/html");It tries to recover the file from the server and verify if it is of contentType.- Parameters:
property- The property name of the current view with an upload editorindex- Position of the filecontentType- The content type, such as image, image/png, text/html, etc.- Throws:
Exception- Since:
- 6.2
-
assertNoFile
Assert if the property with an upload editor has not a file associated. For properties with stereotypes IMAGE, PHOTO, FILE, etc. Example:assertNoFile("photo");- Parameters:
property- The property name of the current view with an upload editor- Throws:
Exception- Since:
- 6.2
-
uploadFile
Upload a file in a property with an upload editor. For properties with stereotypes IMAGE, PHOTO, IMAGES_GALLERY, FILE, FILES, etc. Example:uploadFile("photo", "test-images/cake.gif");- Parameters:
property- The property name of the current view with an upload editorfileURL- If the URL is relative it starts from the current project, if it is absolute (starts with /) it is used 'as is'.- Throws:
Exception- Since:
- 6.2
-
removeFile
Remove the current file from a property with an upload editor. For properties with stereotypes IMAGE, PHOTO, FILE, etc. Example:removeFile("photo");It's like clicking in the X button of the file, if the file is actually deleted from database depends on the concrete editor.- Parameters:
property- The property name of the current view with an upload editor- Throws:
Exception- Since:
- 6.2
-
assertFilesCount
Assert the amount of files in a property with an upload multiple editor. For properties with stereotypes IMAGES_GALLERY, FILES, etc. Example:assertFilesCount("screenshots", 5);- Parameters:
property- The property name of the current view with an upload multiple editorexpectedCount- The expected number of files- Throws:
Exception- Since:
- 6.2
-
removeFile
Remove a file from a property with an upload multiple editor. For properties with stereotypes IMAGES_GALLERY, FILES, etc. Example:removeFile("screenshots", 2);It's like clicking in the X button of the file, if the file is actually deleted from database depends on the concrete editor.- Parameters:
property- The property name of the current view with an upload multiple editorindex- The position (0 based) of the file to remove- Throws:
Exception- Since:
- 6.2
-
moveRow
Move an element of collection from a row to another.It is for @OrderColumn collection where the user can reorder the rows with the mouse.
WARNING! This method does not work for all "from, to" combinations, so if it does not work just try with other combination. Example:moveRow("details", 2, 0);- Parameters:
collection- The name of the collectionfrom- Index of the origin rowto- Index of the target row- Throws:
Exception- Since:
- 6.6
-
moveRow
Move an element of collection from a row to another.It is for @OrderColumn collection where the user can reorder the rows with the mouse.
WARNING! This method does not work for all "from, to" combinations, so if it does not work just try with other combination. Example:moveRow("details", 2, 0);- Parameters:
collection- The name of the collectionfrom- Index of the origin rowto- Index of the target rowclassRequired- If true it verifies the CSS class of target row to assures it is sortable- Throws:
Exception- Since:
- 6.6
-