This script returns the available Expect methods and bindings. It must be run against a device for Entuity to then return the available Expect methods and bindings. The script is only intended for use when developing your first Expect scripts. The results are available through the job history details.
1. println "expect methods:\n"
2. expect.metaClass.methods*.name.sort().unique().each{
3. println it
4. }
5. println "\n\n\n"
6. println "binding contents\n"
7. binding.variables.each{
8. println it.key
9. println it.value
10. }
11.
12. expect.with {
13. setLogUser true
14. println("END")
15. }
Overview of the Expect Methods and Bindings script structure:
- Line 1. queries the groovy class for available methods. The statement orders the methods automatically and for clarity only returns one instance of each method.
- Line 3. outputs the returned methods. it does not require defining as the closure has only one parameter.
- Line 5. adds three line breaks to the output to improve its layout.
- Lines 7. to 10. iterate over the Groovy bindings. The script outputs the name of the variable and its value. For example, target identifies the object against which the script is run.
- Lines 12. to 15. sets user level logging on and prints END when the script finishes.
To run the script against a device, you must have credentials to access the device.
Comments
0 comments
Please sign in to leave a comment.