User-scripted Java harness action that interacts with GUI
In this exercise, we will create a Java-scripted action that interacts with an application’s user interface. We will also create a new Java class to house the new scripted function implementing the action.
In the previous exercise, you created a simple action which wrote out the value of its argument to the results. While it served as a good introduction to writing user-scripted actions, it didn’t demonstrate the true utility of the harness. In this exercise, you will create a much more practical user-scripted action.
The function of action check row count, as you will define it, is to interface with a specified table in a given application window, count the number of rows for which a specified field matches a given value, and to check that count against a given expected count.
The last exercise also demonstrated how code for a new action (hello) can be added to an existing code script module. It is good practice, however, to group actions of similar functionality into their own modules, and you will observe that practice in this exercise.The action check row count operates on tables, hence you will create a new module entitled table support, effectively a place to house all of your table-relatedJava-coded actions. check row count will be implemented in the fileMod_Table.java , which embodies the table support module.
Creating a new Java code script module
Create a new Java module, and provide the code overhead required to access your new user-scripted action.
Scripting a Java-based GUI-interfacing action
In Java code, implement the action that will interface with a target application.
Creating the test case and stub action
After implementing the scripted code that interacts with the target application, set up a stub action for the editor, and create the action lines to set up and call the associated action.
Viewing the test results
Run a test using yourJava-coded action, and ensure that it properly interacts with the target application.