public abstract class AbstractTest

  1. Object
  2. AbstractTest

ImplementsUnitTest

A unit test class that simplifies the process of writing test cases for Codename One.

Constructors

public AbstractTest()

Methods

public void prepare()Prepares the unit test for execution
public void cleanup()Cleanup after a test case executed
public int getTimeoutMillis()Defaults to two minutes.
public boolean shouldExecuteOnEDT()Returns false, default tests run in their own thread.
public void assertBool(boolean b)This method just invokes the test utils method, it is here for convenience
public void assertBool(boolean b, String errorMessage)This method just invokes the test utils method, it is here for convenience
public void fail()This method just invokes the test utils method, it is here for convenience
public void fail(String errorMessage)This method just invokes the test utils method, it is here for convenience
public void assertTrue(boolean value)This method just invokes the test utils method, it is here for convenience
public void assertTrue(boolean value, String errorMessage)This method just invokes the test utils method, it is here for convenience
public void assertFalse(boolean value)This method just invokes the test utils method, it is here for convenience
public void assertFalse(boolean value, String errorMessage)This method just invokes the test utils method, it is here for convenience
public void assertNull(Object object)This method just invokes the test utils method, it is here for convenience
public void assertNull(Object object, String errorMessage)This method just invokes the test utils method, it is here for convenience
public void assertNotNull(Object object)This method just invokes the test utils method, it is here for convenience
public void assertNotNull(Object object, String errorMessage)This method just invokes the test utils method, it is here for convenience
public void assertSame(Object expected, Object actual)This method just invokes the test utils method, it is here for convenience
public void assertSame(Object expected, Object actual, String errorMessage)This method just invokes the test utils method, it is here for convenience
public void assertNotSame(Object expected, Object actual)This method just invokes the test utils method, it is here for convenience
public void assertNotSame(Object expected, Object actual, String errorMessage)This method just invokes the test utils method, it is here for convenience
public void assertEqual(byte expected, byte actual)This method just invokes the test utils method, it is here for convenience
public void assertEqual(byte expected, byte actual, String errorMessage)This method just invokes the test utils method, it is here for convenience
public void assertEqual(short expected, short actual)This method just invokes the test utils method, it is here for convenience
public void assertEqual(short expected, short actual, String errorMessage)This method just invokes the test utils method, it is here for convenience
public void assertEqual(int expected, int actual)This method just invokes the test utils method, it is here for convenience
public void assertEqual(int expected, int actual, String errorMessage)This method just invokes the test utils method, it is here for convenience
public void assertEqual(long expected, long actual)This method just invokes the test utils method, it is here for convenience
public void assertEqual(long expected, long actual, String errorMessage)This method just invokes the test utils method, it is here for convenience
public void assertEqual(float expected, float actual, double maxRelativeError)This method just invokes the test utils method, it is here for convenience
public void assertEqual(float expected, float actual, double maxRelativeError, String errorMessage)This method just invokes the test utils method, it is here for convenience
public void assertEqual(double expected, double actual, double maxRelativeError)This method just invokes the test utils method, it is here for convenience
public void assertRange(double expected, double actual, double maxAbsoluteError)
public void assertRange(double expected, double actual, double maxAbsoluteError, String errorMessage)
public void assertEqual(double expected, double actual, double maxRelativeError, String errorMessage)This method just invokes the test utils method, it is here for convenience
public void assertEqual(Object expected, Object actual)This method just invokes the test utils method, it is here for convenience
public void assertEqual(Object expected, Object actual, String errorMessage)This method just invokes the test utils method, it is here for convenience
public void assertNotEqual(byte expected, byte actual)This method just invokes the test utils method, it is here for convenience
public void assertNotEqual(byte expected, byte actual, String errorMessage)This method just invokes the test utils method, it is here for convenience
public void assertNotEqual(short expected, short actual)This method just invokes the test utils method, it is here for convenience
public void assertNotEqual(short expected, short actual, String errorMessage)This method just invokes the test utils method, it is here for convenience
public void assertNotEqual(int expected, int actual)This method just invokes the test utils method, it is here for convenience
public void assertNotEqual(int expected, int actual, String errorMessage)This method just invokes the test utils method, it is here for convenience
public void assertNotEqual(long expected, long actual)This method just invokes the test utils method, it is here for convenience
public void assertNotEqual(long expected, long actual, String errorMessage)This method just invokes the test utils method, it is here for convenience
public void assertNotEqual(float expected, float actual, double minRelativeError)This method just invokes the test utils method, it is here for convenience
public void assertNotEqual(float expected, float actual, double minRelativeError, String errorMessage)This method just invokes the test utils method, it is here for convenience
public void assertNotEqual(double expected, double actual, double minRelativeError)This method just invokes the test utils method, it is here for convenience
public void assertNotEqual(double expected, double actual, double minRelativeError, String errorMessage)This method just invokes the test utils method, it is here for convenience
public void assertNotEqual(Object expected, Object actual)This method just invokes the test utils method, it is here for convenience
public void assertNotEqual(Object expected, Object actual, String errorMessage)This method just invokes the test utils method, it is here for convenience
public void assertArrayEqual(byte[] expected, byte[] actual)This method just invokes the test utils method, it is here for convenience
public void assertArrayEqual(byte[] expected, byte[] actual, String errorMessage)This method just invokes the test utils method, it is here for convenience
public void assertArrayEqual(short[] expected, short[] actual)This method just invokes the test utils method, it is here for convenience
public void assertArrayEqual(short[] expected, short[] actual, String errorMessage)This method just invokes the test utils method, it is here for convenience
public void assertArrayEqual(int[] expected, int[] actual)This method just invokes the test utils method, it is here for convenience
public void assertArrayEqual(int[] expected, int[] actual, String errorMessage)This method just invokes the test utils method, it is here for convenience
public void assertArrayEqual(long[] expected, long[] actual, long maxRelativeError)This method just invokes the test utils method, it is here for convenience
public void assertArrayEqual(long[] expected, long[] actual, long maxRelativeError, String errorMessage)This method just invokes the test utils method, it is here for convenience
public void assertArrayEqual(float[] expected, float[] actual, double maxRelativeError)This method just invokes the test utils method, it is here for convenience
public void assertArrayEqual(float[] expected, float[] actual, double maxRelativeError, String errorMessage)This method just invokes the test utils method, it is here for convenience
public void assertArrayEqual(double[] expected, double[] actual, double maxRelativeError)This method just invokes the test utils method, it is here for convenience
public void assertArrayEqual(double[] expected, double[] actual, double maxRelativeError, String errorMessage)This method just invokes the test utils method, it is here for convenience
public void assertArrayEqual(Object[] expected, Object[] actual)This method just invokes the test utils method, it is here for convenience
public void assertArrayEqual(Object[] expected, Object[] actual, String errorMessage)This method just invokes the test utils method, it is here for convenience
public void assertException(RuntimeException exception, Runnable expression)This method just invokes the test utils method, it is here for convenience
public void assertException(RuntimeException exception, Runnable expression, String message)This method just invokes the test utils method, it is here for convenience
public void assertNoException(Runnable expression)This method just invokes the test utils method, it is here for convenience
public void assertNoException(Runnable expression, String message)This method just invokes the test utils method, it is here for convenience
public void waitFor(int millis)This method just invokes the test utils method, it is here for convenience
public Component findByName(String componentName)This method just invokes the test utils method, it is here for convenience
public Label findLabelText(String text)This method just invokes the test utils method, it is here for convenience
public void clickButtonByLabel(String text)This method just invokes the test utils method, it is here for convenience
public void clickButtonByName(String name)This method just invokes the test utils method, it is here for convenience
public void clickButtonByPath(int[] path)This method just invokes the test utils method, it is here for convenience
public void goBack()This method just invokes the test utils method, it is here for convenience
public void clickMenuItem(String name)This method just invokes the test utils method, it is here for convenience
public void ensureVisible(Component c)This method just invokes the test utils method, it is here for convenience
public void ensureVisible(int[] c)This method just invokes the test utils method, it is here for convenience
public void ensureVisible(String c)This method just invokes the test utils method, it is here for convenience
public void waitForFormTitle(String title)This method just invokes the test utils method, it is here for convenience
public void waitForUnnamedForm()Waits for a form change and if no form change occurred after a given timeout then fail the test
public void waitForFormName(String name)This method just invokes the test utils method, it is here for convenience
public void log(String t)This method just invokes the test utils method, it is here for convenience
public void log(Throwable t)This method just invokes the test utils method, it is here for convenience
public boolean screenshotTest(String screenshotName)This method just invokes the test utils method, it is here for convenience
public void keyPress(int keyCode)This method just invokes the test utils method, it is here for convenience
public void keyRelease(int keyCode)This method just invokes the test utils method, it is here for convenience
public void gameKeyPress(int gameKey)This method just invokes the test utils method, it is here for convenience
public void gameKeyRelease(int gameKey)This method just invokes the test utils method, it is here for convenience
public void pointerPress(float x, float y, String componentName)This method just invokes the test utils method, it is here for convenience
public void pointerRelease(float x, float y, String componentName)This method just invokes the test utils method, it is here for convenience
public void pointerDrag(float x, float y, String componentName)This method just invokes the test utils method, it is here for convenience
public void pointerPress(float x, float y, int[] path)This method just invokes the test utils method, it is here for convenience
public void pointerRelease(float x, float y, int[] path)This method just invokes the test utils method, it is here for convenience
public void pointerDrag(float x, float y, int[] path)This method just invokes the test utils method, it is here for convenience
public Component getComponentByPath(int[] path)This method just invokes the test utils method, it is here for convenience
public void setText(String name, String text)This method just invokes the test utils method, it is here for convenience
public void setText(int[] path, String text)This method just invokes the test utils method, it is here for convenience
public void assertTitle(String title)This method just invokes the test utils method, it is here for convenience
public void assertLabel(String name, String text)This method just invokes the test utils method, it is here for convenience
public void assertLabel(String text)This method just invokes the test utils method, it is here for convenience
public void assertLabel(int[] path, String text)This method just invokes the test utils method, it is here for convenience
public void assertTextArea(String name, String text)This method just invokes the test utils method, it is here for convenience
public void assertTextArea(int[] path, String text)This method just invokes the test utils method, it is here for convenience
public void assertTextArea(String text)This method just invokes the test utils method, it is here for convenience
public TextArea findTextAreaText(String text)This method just invokes the test utils method, it is here for convenience
public void setVerboseMode(boolean v)This method just invokes the test utils method, it is here for convenience
public void selectInList(String listName, int offset)This method just invokes the test utils method, it is here for convenience
public void selectInList(int[] path, int offset)This method just invokes the test utils method, it is here for convenience
public Command[] getToolbarCommands()Returns all the command objects from the toolbar in the order of left, right, overflow & sidemenu
public void executeToolbarCommandAtOffset(int offset)Executes a command from the offset returned by #getToolbarCommands()
public void showSidemenu()Shows the sidemenu UI

Inherited methods

Constructor details

AbstractTest

public AbstractTest()

Method details

prepare

public void prepare()
Prepares the unit test for execution

cleanup

public void cleanup()
Cleanup after a test case executed

getTimeoutMillis

public int getTimeoutMillis()

Defaults to two minutes.

Returns the time in milliseconds after which the test should be automatically failed.

Returns

time in milliseconds

shouldExecuteOnEDT

public boolean shouldExecuteOnEDT()

Returns false, default tests run in their own thread.

Returns true to indicate that the test expects to be executed on the EDT

Returns

whether the test should execute on the EDT or the testing thread

assertBool

public void assertBool(boolean b)
This method just invokes the test utils method, it is here for convenience

See also

assertBool

public void assertBool(boolean b, String errorMessage)
This method just invokes the test utils method, it is here for convenience

See also

fail

public void fail()
This method just invokes the test utils method, it is here for convenience

See also

fail

public void fail(String errorMessage)
This method just invokes the test utils method, it is here for convenience

See also

assertTrue

public void assertTrue(boolean value)
This method just invokes the test utils method, it is here for convenience

See also

assertTrue

public void assertTrue(boolean value, String errorMessage)
This method just invokes the test utils method, it is here for convenience

See also

assertFalse

public void assertFalse(boolean value)
This method just invokes the test utils method, it is here for convenience

See also

assertFalse

public void assertFalse(boolean value, String errorMessage)
This method just invokes the test utils method, it is here for convenience

See also

assertNull

public void assertNull(Object object)
This method just invokes the test utils method, it is here for convenience

See also

assertNull

public void assertNull(Object object, String errorMessage)
This method just invokes the test utils method, it is here for convenience

See also

assertNotNull

public void assertNotNull(Object object)
This method just invokes the test utils method, it is here for convenience

See also

assertNotNull

public void assertNotNull(Object object, String errorMessage)
This method just invokes the test utils method, it is here for convenience

See also

assertSame

public void assertSame(Object expected, Object actual)
This method just invokes the test utils method, it is here for convenience

See also

assertSame

public void assertSame(Object expected, Object actual, String errorMessage)
This method just invokes the test utils method, it is here for convenience

See also

assertNotSame

public void assertNotSame(Object expected, Object actual)
This method just invokes the test utils method, it is here for convenience

See also

assertNotSame

public void assertNotSame(Object expected, Object actual, String errorMessage)
This method just invokes the test utils method, it is here for convenience

See also

assertEqual

public void assertEqual(byte expected, byte actual)
This method just invokes the test utils method, it is here for convenience

See also

assertEqual

public void assertEqual(byte expected, byte actual, String errorMessage)
This method just invokes the test utils method, it is here for convenience

See also

assertEqual

public void assertEqual(short expected, short actual)
This method just invokes the test utils method, it is here for convenience

See also

assertEqual

public void assertEqual(short expected, short actual, String errorMessage)
This method just invokes the test utils method, it is here for convenience

See also

assertEqual

public void assertEqual(int expected, int actual)
This method just invokes the test utils method, it is here for convenience

See also

assertEqual

public void assertEqual(int expected, int actual, String errorMessage)
This method just invokes the test utils method, it is here for convenience

See also

assertEqual

public void assertEqual(long expected, long actual)
This method just invokes the test utils method, it is here for convenience

See also

assertEqual

public void assertEqual(long expected, long actual, String errorMessage)
This method just invokes the test utils method, it is here for convenience

See also

assertEqual

public void assertEqual(float expected, float actual, double maxRelativeError)
This method just invokes the test utils method, it is here for convenience

See also

assertEqual

public void assertEqual(float expected, float actual, double maxRelativeError, String errorMessage)
This method just invokes the test utils method, it is here for convenience

See also

assertEqual

public void assertEqual(double expected, double actual, double maxRelativeError)
This method just invokes the test utils method, it is here for convenience

See also

assertRange

public void assertRange(double expected, double actual, double maxAbsoluteError)

assertRange

public void assertRange(double expected, double actual, double maxAbsoluteError, String errorMessage)

assertEqual

public void assertEqual(double expected, double actual, double maxRelativeError, String errorMessage)
This method just invokes the test utils method, it is here for convenience

See also

assertEqual

public void assertEqual(Object expected, Object actual)
This method just invokes the test utils method, it is here for convenience

See also

assertEqual

public void assertEqual(Object expected, Object actual, String errorMessage)
This method just invokes the test utils method, it is here for convenience

See also

assertNotEqual

public void assertNotEqual(byte expected, byte actual)
This method just invokes the test utils method, it is here for convenience

See also

assertNotEqual

public void assertNotEqual(byte expected, byte actual, String errorMessage)
This method just invokes the test utils method, it is here for convenience

See also

assertNotEqual

public void assertNotEqual(short expected, short actual)
This method just invokes the test utils method, it is here for convenience

See also

assertNotEqual

public void assertNotEqual(short expected, short actual, String errorMessage)
This method just invokes the test utils method, it is here for convenience

See also

assertNotEqual

public void assertNotEqual(int expected, int actual)
This method just invokes the test utils method, it is here for convenience

See also

assertNotEqual

public void assertNotEqual(int expected, int actual, String errorMessage)
This method just invokes the test utils method, it is here for convenience

See also

assertNotEqual

public void assertNotEqual(long expected, long actual)
This method just invokes the test utils method, it is here for convenience

See also

assertNotEqual

public void assertNotEqual(long expected, long actual, String errorMessage)
This method just invokes the test utils method, it is here for convenience

See also

assertNotEqual

public void assertNotEqual(float expected, float actual, double minRelativeError)
This method just invokes the test utils method, it is here for convenience

See also

assertNotEqual

public void assertNotEqual(float expected, float actual, double minRelativeError, String errorMessage)
This method just invokes the test utils method, it is here for convenience

See also

assertNotEqual

public void assertNotEqual(double expected, double actual, double minRelativeError)
This method just invokes the test utils method, it is here for convenience

See also

assertNotEqual

public void assertNotEqual(double expected, double actual, double minRelativeError, String errorMessage)
This method just invokes the test utils method, it is here for convenience

See also

assertNotEqual

public void assertNotEqual(Object expected, Object actual)
This method just invokes the test utils method, it is here for convenience

See also

assertNotEqual

public void assertNotEqual(Object expected, Object actual, String errorMessage)
This method just invokes the test utils method, it is here for convenience

See also

assertArrayEqual

public void assertArrayEqual(byte[] expected, byte[] actual)
This method just invokes the test utils method, it is here for convenience

See also

assertArrayEqual

public void assertArrayEqual(byte[] expected, byte[] actual, String errorMessage)
This method just invokes the test utils method, it is here for convenience

See also

assertArrayEqual

public void assertArrayEqual(short[] expected, short[] actual)
This method just invokes the test utils method, it is here for convenience

See also

assertArrayEqual

public void assertArrayEqual(short[] expected, short[] actual, String errorMessage)
This method just invokes the test utils method, it is here for convenience

See also

assertArrayEqual

public void assertArrayEqual(int[] expected, int[] actual)
This method just invokes the test utils method, it is here for convenience

See also

assertArrayEqual

public void assertArrayEqual(int[] expected, int[] actual, String errorMessage)
This method just invokes the test utils method, it is here for convenience

See also

assertArrayEqual

public void assertArrayEqual(long[] expected, long[] actual, long maxRelativeError)
This method just invokes the test utils method, it is here for convenience

See also

assertArrayEqual

public void assertArrayEqual(long[] expected, long[] actual, long maxRelativeError, String errorMessage)
This method just invokes the test utils method, it is here for convenience

See also

assertArrayEqual

public void assertArrayEqual(float[] expected, float[] actual, double maxRelativeError)
This method just invokes the test utils method, it is here for convenience

See also

assertArrayEqual

public void assertArrayEqual(float[] expected, float[] actual, double maxRelativeError, String errorMessage)
This method just invokes the test utils method, it is here for convenience

See also

assertArrayEqual

public void assertArrayEqual(double[] expected, double[] actual, double maxRelativeError)
This method just invokes the test utils method, it is here for convenience

See also

assertArrayEqual

public void assertArrayEqual(double[] expected, double[] actual, double maxRelativeError, String errorMessage)
This method just invokes the test utils method, it is here for convenience

See also

assertArrayEqual

public void assertArrayEqual(Object[] expected, Object[] actual)
This method just invokes the test utils method, it is here for convenience

See also

assertArrayEqual

public void assertArrayEqual(Object[] expected, Object[] actual, String errorMessage)
This method just invokes the test utils method, it is here for convenience

See also

assertException

public void assertException(RuntimeException exception, Runnable expression)
This method just invokes the test utils method, it is here for convenience

See also

assertException

public void assertException(RuntimeException exception, Runnable expression, String message)
This method just invokes the test utils method, it is here for convenience

See also

assertNoException

public void assertNoException(Runnable expression)
This method just invokes the test utils method, it is here for convenience

See also

assertNoException

public void assertNoException(Runnable expression, String message)
This method just invokes the test utils method, it is here for convenience

See also

waitFor

public void waitFor(int millis)
This method just invokes the test utils method, it is here for convenience

See also

findByName

public Component findByName(String componentName)
This method just invokes the test utils method, it is here for convenience

See also

findLabelText

public Label findLabelText(String text)
This method just invokes the test utils method, it is here for convenience

See also

clickButtonByLabel

public void clickButtonByLabel(String text)
This method just invokes the test utils method, it is here for convenience

See also

clickButtonByName

public void clickButtonByName(String name)
This method just invokes the test utils method, it is here for convenience

See also

clickButtonByPath

public void clickButtonByPath(int[] path)
This method just invokes the test utils method, it is here for convenience

See also

goBack

public void goBack()
This method just invokes the test utils method, it is here for convenience

See also

clickMenuItem

public void clickMenuItem(String name)
This method just invokes the test utils method, it is here for convenience

See also

ensureVisible

public void ensureVisible(Component c)
This method just invokes the test utils method, it is here for convenience

See also

ensureVisible

public void ensureVisible(int[] c)
This method just invokes the test utils method, it is here for convenience

See also

ensureVisible

public void ensureVisible(String c)
This method just invokes the test utils method, it is here for convenience

See also

waitForFormTitle

public void waitForFormTitle(String title)
This method just invokes the test utils method, it is here for convenience

See also

waitForUnnamedForm

public void waitForUnnamedForm()
Waits for a form change and if no form change occurred after a given timeout then fail the test

waitForFormName

public void waitForFormName(String name)
This method just invokes the test utils method, it is here for convenience

See also

log

public void log(String t)
This method just invokes the test utils method, it is here for convenience

See also

log

public void log(Throwable t)
This method just invokes the test utils method, it is here for convenience

See also

screenshotTest

public boolean screenshotTest(String screenshotName)
This method just invokes the test utils method, it is here for convenience

See also

keyPress

public void keyPress(int keyCode)
This method just invokes the test utils method, it is here for convenience

See also

keyRelease

public void keyRelease(int keyCode)
This method just invokes the test utils method, it is here for convenience

See also

gameKeyPress

public void gameKeyPress(int gameKey)
This method just invokes the test utils method, it is here for convenience

See also

gameKeyRelease

public void gameKeyRelease(int gameKey)
This method just invokes the test utils method, it is here for convenience

See also

pointerPress

public void pointerPress(float x, float y, String componentName)
This method just invokes the test utils method, it is here for convenience

See also

pointerRelease

public void pointerRelease(float x, float y, String componentName)
This method just invokes the test utils method, it is here for convenience

See also

pointerDrag

public void pointerDrag(float x, float y, String componentName)
This method just invokes the test utils method, it is here for convenience

See also

pointerPress

public void pointerPress(float x, float y, int[] path)
This method just invokes the test utils method, it is here for convenience

See also

pointerRelease

public void pointerRelease(float x, float y, int[] path)
This method just invokes the test utils method, it is here for convenience

See also

pointerDrag

public void pointerDrag(float x, float y, int[] path)
This method just invokes the test utils method, it is here for convenience

See also

getComponentByPath

public Component getComponentByPath(int[] path)
This method just invokes the test utils method, it is here for convenience

See also

setText

public void setText(String name, String text)
This method just invokes the test utils method, it is here for convenience

See also

setText

public void setText(int[] path, String text)
This method just invokes the test utils method, it is here for convenience

See also

assertTitle

public void assertTitle(String title)
This method just invokes the test utils method, it is here for convenience

See also

assertLabel

public void assertLabel(String name, String text)
This method just invokes the test utils method, it is here for convenience

See also

assertLabel

public void assertLabel(String text)
This method just invokes the test utils method, it is here for convenience

See also

assertLabel

public void assertLabel(int[] path, String text)
This method just invokes the test utils method, it is here for convenience

See also

assertTextArea

public void assertTextArea(String name, String text)
This method just invokes the test utils method, it is here for convenience

See also

assertTextArea

public void assertTextArea(int[] path, String text)
This method just invokes the test utils method, it is here for convenience

See also

assertTextArea

public void assertTextArea(String text)
This method just invokes the test utils method, it is here for convenience

See also

findTextAreaText

public TextArea findTextAreaText(String text)
This method just invokes the test utils method, it is here for convenience

See also

setVerboseMode

public void setVerboseMode(boolean v)
This method just invokes the test utils method, it is here for convenience

See also

selectInList

public void selectInList(String listName, int offset)
This method just invokes the test utils method, it is here for convenience

See also

selectInList

public void selectInList(int[] path, int offset)
This method just invokes the test utils method, it is here for convenience

See also

getToolbarCommands

public Command[] getToolbarCommands()
Returns all the command objects from the toolbar in the order of left, right, overflow & sidemenu

Returns

the set of commands

executeToolbarCommandAtOffset

public void executeToolbarCommandAtOffset(int offset)
Executes a command from the offset returned by #getToolbarCommands()

Parameters

offset int
the offset of the command we want to execute

showSidemenu

public void showSidemenu()
Shows the sidemenu UI