Package ghidra.test
Class AbstractProgramBasedTest
- java.lang.Object
- 
 public abstract class AbstractProgramBasedTest extends AbstractGhidraHeadedIntegrationTest A convenience base class for creating tests that use the default tool and open a program. This class will create for you a tool, aTestEnvand will open the program specified bygetProgramName().To use this class, you must call initialize()from your test orsetUpmethod.Note: if you are loading a pre-existing program, then simply override getProgramName(). Alternatively, if you are building a program, then overridegetProgram()and return it there.
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from class generic.test.AbstractGenericTestAbstractGenericTest.ExceptionHandlingRunner
 
- 
 - 
Field SummaryFields Modifier and Type Field Description protected ghidra.app.plugin.core.codebrowser.CodeBrowserPlugincodeBrowserprotected TestEnvenvprotected Programprogramprotected PluginTooltool- 
Fields inherited from class ghidra.test.AbstractGhidraHeadlessIntegrationTestPROJECT_NAME
 - 
Fields inherited from class generic.test.AbstractGenericTestconcurrentTestExceptionRule, DEFAULT_TEST_TOOL_NAME, DEFAULT_TOOL_NAME, ruleChain, TESTDATA_DIRECTORY_NAME, watchman
 - 
Fields inherited from class generic.test.AbstractGTestBATCH_MODE, DEFAULT_WAIT_DELAY, DEFAULT_WAIT_TIMEOUT, DEFAULT_WINDOW_TIMEOUT, PARALLEL_MODE, PRIVATE_LONG_WAIT_TIMEOUT, testName
 
- 
 - 
Constructor SummaryConstructors Constructor Description AbstractProgramBasedTest()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description Addressaddr(long offset)Addressaddr(Program p, long offset)Addressaddr(Program p, java.lang.String offset)Addressaddr(java.lang.String offset)java.util.List<Address>addrs(long... offsets)java.util.List<Address>addrs(Address... addrs)voidassertCurrentAddress(Address expected)<R,E extends java.lang.Exception>
 RcreateInProgram(ExceptionalFunction<Program,R,E> f)Provides a convenient method for modifying the current program, handling the transaction logic and returning a new item as a result.Functionfunction(Address addr)protected ProgramgetProgram()Override this method if you need to build your own program.protected java.lang.StringgetProgramName()voidgoTo(long offset)voidgoTo(Address a)voidgoTo(java.lang.String offset)protected voidinitialize()<E extends java.lang.Exception>
 voidmodifyProgram(ExceptionalConsumer<Program,E> callback)Provides a convenient method for modifying the current program, handling the transaction logic.AddressRangerange(long from, long to)voidshowProvider(java.lang.String name)voidtearDown()AddressSettoAddressSet(long... offsets)- 
Methods inherited from class ghidra.test.AbstractGhidraHeadedIntegrationTestaddPlugin, click, click, click, click, createApplicationConfiguration, createApplicationLayout, getAction, getPluginByName, saveTool, showDialogWithoutBlocking, showTool, waitForBusyTool, waitForProgram
 - 
Methods inherited from class ghidra.test.AbstractGhidraHeadlessIntegrationTestapplyCmd, 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, makeSelection, modifyProgram, modifyProgram, redo, redo, redo, replaceService, toAddressSet, toAddressSet, toAddressSet, tx, undo, undo, undo, waitForScriptCompletion
 - 
Methods inherited from class docking.test.AbstractDockingTestassertEnabled, 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, 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, writeImage
 - 
Methods inherited from class generic.test.AbstractGenericTestclickListRange, 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, yieldToSwing
 - 
Methods inherited from class generic.test.AbstractGTestassertArraysEqualOrdered, assertArraysEqualUnordered, assertArraysEqualUnordered, assertContainsExactly, assertContainsExactly, 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 Detail- 
envprotected TestEnv env 
 - 
toolprotected PluginTool tool 
 - 
programprotected Program program 
 - 
codeBrowserprotected ghidra.app.plugin.core.codebrowser.CodeBrowserPlugin codeBrowser 
 
- 
 - 
Method Detail- 
getProgramNameprotected java.lang.String getProgramName() 
 - 
initializeprotected void initialize() throws java.lang.Exception- Throws:
- java.lang.Exception
 
 - 
getProgramprotected Program getProgram() throws java.lang.Exception Override this method if you need to build your own program.- Returns:
- the program to use for this test.
- Throws:
- java.lang.Exception- if an exception is thrown opening the program
 
 - 
tearDownpublic void tearDown() throws java.lang.Exception- Throws:
- java.lang.Exception
 
 - 
assertCurrentAddresspublic void assertCurrentAddress(Address expected) 
 - 
addrpublic Address addr(long offset) 
 - 
addrpublic Address addr(java.lang.String offset) 
 - 
goTopublic void goTo(long offset) 
 - 
goTopublic void goTo(java.lang.String offset) 
 - 
rangepublic AddressRange range(long from, long to) 
 - 
showProviderpublic void showProvider(java.lang.String name) 
 - 
addrspublic java.util.List<Address> addrs(long... offsets) 
 - 
toAddressSetpublic AddressSet toAddressSet(long... offsets) 
 - 
goTopublic void goTo(Address a) 
 - 
modifyProgrampublic <E extends java.lang.Exception> void modifyProgram(ExceptionalConsumer<Program,E> callback) Provides a convenient method for modifying the current program, handling the transaction logic.- Parameters:
- callback- the code to execute
 
 - 
createInProgrampublic <R,E extends java.lang.Exception> R createInProgram(ExceptionalFunction<Program,R,E> f) 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
 
 
- 
 
-