Costello Tutorial

by: Aleksandr Movsesyan

Purpose/benefits

Costello allows users to automate their system test cases. This is easier with Costello because since you can just run your program and record your actions through Costello. Instead of writing down all the steps you must take to test the functionality of your written code, you can just load the program like usual and allow Costello to record all the steps needed to run the system test case. Also, it allows for playback which shows proof that the test was ran and worked. You can also do asserts in the script to ensure everything worked correctly.


Brief overview

  1. Download Costello
  2. Open Costello from the lib directory
  3. Open a new script
  4. Enter the name of the main method to start
  5. Enter the arguments that are needed into the the arg section
  6. Enter the jar files needed for the classpath
  7. Go to the test menu and press launch to make sure that it works
  8. Go to the capture menu and capture all actions
  9. Run through the system test
  10. Close the program
  11. Then you can go to the test menu and press run
  12. It should run through the system test automatically


Walkthrough

Opening Costello

  1. Go to the folder containing Costello
  2. Double click on the jar file and the script editor should open
  3. If you are using command line then type in the command: java -jar costello.jar once in the lib directory of abbot

Set Up

  1. Go to the file menu and select new script
  2. In the target class name: enter the main class of the program where it will start. Example: bluej.Boot for starting BlueJ.
  3. In the method field: enter the name of the method you wish to run. For BlueJ leave it as main
  4. In the arguments field: enter the arguments needed to pass to the method you are running. To add more arguments press the plus button. For BlueJ leave as is with no arguments
  5. Now enter the class paths. To add additional class paths press the plus button. For BlueJ you need to input the following jar files: tools.jar from your java jdk lib folder, bluej.jar, bluejcore.jar, bluejext.jar, bluejeditor.jar, MRJ141Stubs.jar, and antlr.jar from the BlueJ lib folder
  6. Now the script should be ready to capture your tests

Capturing Scripts

  1. Once the script is set up, go to the Test menu and press launch(Ctrl+L).
  2. After launching the application go to the Capture menu and select either All Actions of All Actions(include motion).
  3. Now go back to your program and run through your actions to do what you need.
  4. Costello will automatically record a script.
  5. To pause/stop recording: press SHIFT+F2, click on the Costello UI, or close your program.

Using Asserts

  1. Make sure the program is launched. Costello doesn't know about the different components until the program is launched.
  2. Access the different components by expand/collapse the branches from the tree structure of the components.
  3. Find and select the desired component that you wish to assert.
  4. Select that component and then look at the properties in the right lower right panel of Costello.
  5. Select the component you wish to assert and press the Assert Equals button underneath the properties panel.
  6. To change the value you wish to assert, after pressing the Assert Equals button select the Assert in the main panel of Costello and change the Expected Result field.

Running Scripts

  1. Go to Test menu and click Run(Ctrl+R) or click the Run button on the top right of the Costello UI. If an assert fails, the test script will be stopped.
  2. You can also run the script to a certain part in the script. To do this expand the script that Costello made and select the step which you would like to stop at. Now go to the Test menu and click Run To Selection.
  3. The final way to run the script is to select the steps that you wish to run and go to the Test menu and click Run Selection(Ctrl+Shift+R)

Additional Notes

  • Save the Costello script as an .xml file
  • To read the entire stack trace when a test fails, left click on the bottom of the Costello where it states there's an error.
  • To remove a test: select a the script, go to the Edit menu, and select Cut or just press Ctrl+X.


Exercise

Make a script with BlueJ as described above in the walkthrough. Make sure you are running this on the lab machines using the Fedora cores. It doesn't work with Windows for some reason while running BlueJ.


References

Abbot Homepage