Package ghidra.test
Class AbstractProgramBasedTest
A convenience base class for creating tests that use the default tool and open a program.
This class will create for you a tool, a
TestEnv and will open the program
specified by getProgramName().
To use this class, you must call initialize() from your test or setUp
method.
Note: if you are loading a pre-existing program, then simply override
getProgramName(). Alternatively, if you are building a program, then override
getProgram() and return it there.
-
Nested Class Summary
Nested classes/interfaces inherited from class generic.test.AbstractGenericTest
AbstractGenericTest.ExceptionHandlingRunner -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ghidra.app.plugin.core.codebrowser.CodeBrowserPluginprotected TestEnvprotected Programprotected PluginToolFields inherited from class ghidra.test.AbstractGhidraHeadlessIntegrationTest
PROJECT_NAMEFields inherited from class generic.test.AbstractGenericTest
concurrentTestExceptionRule, DEFAULT_TEST_TOOL_NAME, DEFAULT_TOOL_NAME, repeatedRule, ruleChain, TESTDATA_DIRECTORY_NAME, watchmanFields inherited from class generic.test.AbstractGTest
BATCH_MODE, DEFAULT_WAIT_DELAY, DEFAULT_WAIT_TIMEOUT, DEFAULT_WINDOW_TIMEOUT, PARALLEL_MODE, PRIVATE_LONG_WAIT_TIMEOUT, testName -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddr(long offset) addrs(long... offsets) voidassertCurrentAddress(Address expected) <R,E extends Exception>
RProvides a convenient method for modifying the current program, handling the transaction logic and returning a new item as a result.protected ProgramOverride this method if you need to build your own program.protected StringvoidgoTo(long offset) voidvoidprotected void<E extends Exception>
voidmodifyProgram(ExceptionalConsumer<Program, E> callback) Provides a convenient method for modifying the current program, handling the transaction logic.range(long from, long to) voidshowProvider(String name) voidtearDown()toAddressSet(long... offsets) Methods inherited from class ghidra.test.AbstractGhidraHeadedIntegrationTest
addPlugin, click, click, click, click, createApplicationConfiguration, createApplicationLayout, getAction, getPluginByName, saveTool, showDialogWithoutBlocking, showTool, waitForBusyTool, waitForProgramMethods inherited from class ghidra.test.AbstractGhidraHeadlessIntegrationTest
applyCmd, cleanDbTestDir, createDefaultProgram, createDefaultProgram, debugProgramInTool, deleteProject, getLanguageCompilerSpecPair, getLanguageService, getPlugin, getSLEIGH_8051_LANGUAGE, getSLEIGH_X86_64_LANGUAGE, getSLEIGH_X86_LANGUAGE, getUniqueSymbol, getUniqueSymbol, getZ80_LANGUAGE, goTo, goTo, initializeSystemProperties, makeSelection, makeSelection, makeSelection, makeSelection, modifyProgram, modifyProgram, redo, redo, redo, replaceService, toAddressSet, toAddressSet, toAddressSet, tx, tx, undo, undo, undo, waitForScriptCompletionMethods inherited from class docking.test.AbstractDockingTest
assertEnabled, assertToggleButtonSelected, capture, clickComponentProvider, clickComponentProvider, close, close, closeAllWindows, closeAllWindows, closeAllWindowsAndFrames, closeProvider, closeSaveChangesDialog, createContext, createContext, createRenderedImage, createScreenImage, disposeErrorGUI, dockingSetUp, dockingTearDown, expandPath, expandTree, findButtonByActionName, findButtonByIcon, findButtonByText, findComponent, findComponentByName, getAction, getAction, getAction, getActionsByName, getActionsByOwner, getActionsByOwnerAndName, getClipboardText, getComponentProvider, getDialogComponent, getDialogComponentProvider, getDockableComponent, getLocalAction, getMessageText, getNode, getOpenWindowsAsString, getStatusText, getTitleForWindow, getWindow, getWindowByTitle, getWindowByTitleContaining, getWindows, isEnabled, isEnabled, isEnabled, isSelected, isUseErrorGUI, performAction, performAction, performAction, performAction, performDialogAction, pressButtonByText, pressButtonByText, printOpenWindows, selectPath, selectTabIfAvailable, setErrorGUIEnabled, setToggleActionSelected, setToggleActionSelected, setToggleButtonSelected, setToggleButtonSelected, showProvider, triggerActionKey, triggerActionKey, triggerBackspaceKey, triggerEnter, triggerEscapeKey, triggerKey, triggerKey, triggerKey, triggerText, triggerText, waitForComponentProvider, waitForComponentProvider, waitForComponentProvider, waitForDialogComponent, waitForDialogComponent, waitForDialogComponent, waitForErrorDialog, waitForInfoDialog, waitForJDialog, waitForJDialog, waitForTableModel, waitForTree, waitForUpdateOnChooser, waitForWindow, waitForWindow, waitForWindow, waitForWindowByName, waitForWindowByTitleContaining, writeImage, writeImageMethods inherited from class generic.test.AbstractGenericTest
clickListRange, clickMouse, clickMouse, clickTableCell, clickTableRange, createStackTraceForAllThreads, createTempDirectory, createTempFile, createTempFile, createTempFileForTest, createTempFileForTest, createTempFilePath, createTempFilePath, deleteMatchingTempFiles, deleteSimilarTempFiles, doubleClick, dragMouse, editCell, executeOnSwingWithoutBlocking, findAbstractButtonByName, findAbstractButtonByText, findButtonByIcon, findButtonByText, findComponent, findComponent, findComponentByName, findComponentByName, findComponentsByName, findOwnedWindows, findPathToText, findTestDataFile, findTreePathToText, fixupGUI, getAllWindows, getDebugFileDirectory, getFontMetrics, getInstanceField, getInstanceFieldByClassType, getLocalResourceFile, getRenderedTableCellValue, getTestDataDir, getTestDataDirectory, getTestDataFile, getText, hasTestFailed, initializeLayout, invokeConstructor, invokeInstanceMethod, invokeInstanceMethod, leftClick, loadTextResource, loadTextResource, middleClick, moveMouse, postEvent, pressButton, pressButton, pressButtonByName, pressButtonByName, pressButtonByText, pressButtonByText, printMemory, privateWaitForPostedSwingRunnables_SwingSafe, rightClick, runSwing, runSwing, runSwing, runSwingLater, runSwingWithException, setComboBoxSelection, setErrorsExpected, setInstanceField, setText, testFailed, toString, waitForPostedSwingRunnables, waitForSwing, waitForTasks, windowForComponent, yieldToSwingMethods inherited from class generic.test.AbstractGTest
assertArraysEqualOrdered, assertArraysEqualUnordered, assertArraysEqualUnordered, assertContainsExactly, assertContainsExactly, assertContainsString, assertContainsStringIgnoringCase, assertListEqualOrdered, assertListEqualOrdered, assertListEqualsArrayOrdered, assertListEqualsArrayUnordered, assertListEqualUnordered, bytes, failWithException, getName, getRandomInt, getRandomInt, getRandomString, getRandomString, getTestDirectoryPath, sleep, waitFor, waitFor, waitFor, waitFor, waitFor, waitForCondition, waitForCondition, waitForCondition, waitForConditionWithoutFailing, waitForValue, waitForValueWithoutFailing
-
Field Details
-
env
-
tool
-
program
-
codeBrowser
protected ghidra.app.plugin.core.codebrowser.CodeBrowserPlugin codeBrowser
-
-
Constructor Details
-
AbstractProgramBasedTest
public AbstractProgramBasedTest()
-
-
Method Details
-
getProgramName
-
initialize
- Throws:
Exception
-
getProgram
Override this method if you need to build your own program.- Returns:
- the program to use for this test.
- Throws:
Exception- if an exception is thrown opening the program
-
tearDown
- Throws:
Exception
-
assertCurrentAddress
-
addr
-
addr
-
addr
-
addr
-
goTo
public void goTo(long offset) -
goTo
-
range
-
showProvider
-
function
-
addrs
-
toAddressSet
-
addrs
-
goTo
-
modifyProgram
Provides a convenient method for modifying the current program, handling the transaction logic.- Parameters:
callback- the code to execute
-
createInProgram
Provides a convenient method for modifying the current program, handling the transaction logic and returning a new item as a result.- Parameters:
f- the function for modifying the program and creating the desired result- Returns:
- the result
-