Hello, you are not logged in.  Login or sign up
Community >> Blogs
Search Toad World Search

Blogs
Toad and Database Commentaries

 Toad World blogs are a mix of insightful how-tos from Quest experts as well as their commentary on experiences with new database technologies.

Do you have a topic that you'd like discussed?  We'd love to hear from you.  Send us your idea for a blog topic.

Still Testing Your PL/SQL Manually? STOP-RIGHT-NOW.
 
Location: Blogs Jeff Smith    
 JeffSmith Monday, June 30, 2008 7:51 AM
Anyone who develops, supports, or uses PL/SQL at some level also tests the PL/SQL. It may not be a formal testing environment, but there is a time where you will probably ask yourself, “Does this program actually do what it is supposed to?” I think this is something we can all relate to as computer users.
 
This type of testing probably involves clicking a few buttons, then poking around the database or file system after the fact to make sure what you expect to see exists. There of course are other types of testing that generally happens inside the development team responsible for the code in question. You have developers writing the code and doing their testing before sending it to the QA group for verification, and then you have the QA group that has a very defined and rigid set of functionality tests that ensure the application does what it is supposed to do. These defined tests eventually get converted into Regression scripts and then are ran as needed to ensure any work done on the code after it has been released does not break anything that was previously working.
 
Ok, so none of this should be news to you, the Oracle enthusiast who is also working with PL/SQL. What may be news to you is that for the past year now Quest has had a technology that can automate this causal to rigid testing methodology for PL/SQL. What’s even more exciting is that in the past release of Toad, this technology has been directly incorporated into your PL/SQL IDE, i.e. Toad for Oracle.
 
One-button-press testing, courtesy of Quest.
 
Shenanigans You Say?
 
Ok, I need to come clean just a bit I suppose. Toad cannot look at your code and automatically compose tests for you on the fly and then just run them and let you know how they went. This would be an awesome technology if it existed, wouldn’t it? So what exactly can Toad do for you here?
 
What if you just described in plain terms what your program should be doing, say in terms of:
  • My table(s) should be updated/deleted/inserted appropriately and look like this
  • My function should return this cursor and/or collection
  • These OS files should be updated/added/deleted
  • My program should run in less than X seconds
  • My program should always raise this exception under these circumstances.
If you take the few minutes to do this, we can turn these expectations into a testing program that can ensure your code is doing what is supposed to be doing today, and will continue to do so for its entire life expectancy.
 
One other little disclaimer, this technology is actually a stand-alone technology called Quest Code Tester for Oracle. But, if you buy it with Toad, it’s basically half-price, and then you have the instant integration.
 
So if I were to click the ‘magic button’, after I had made a change to my program I would instantly know that all things are not as expected according to my pre-defined tests.
 
 
In about 5 seconds, Toad was able to report back that 1 of our 4 test cases failed. It also was able to show me the actual versus the expected results.
 
How Does it Work?
 
When you click the Code Tester button, Toad will open Quest's "integrated testing environment." This is where you will describe your test cases and maintain the test code.
 

 
In about 2 minutes I was able to define 5 test cases that actually run through about 20 different scenarios using the random test input data management piece included in the product. Now, as long as I don’t add new features or drastically change the behavior of the program, I can rely on this test suite to let me know if something happens to break my program. If someone inherits my program later and needs to enhance it, they simply need to take an extra minute to enhance the test suite as well.
 
How Does it REALLY Work?
 
Have you ever heard the saying ‘Good developers write good programs, but great developers write programs to write good programs for them?’ That’s the essence of what’s happening under the covers hear. Quest has a great developer who had dedicated the last five years or so of his professional career at making this technology available for PL/SQL professionals everywhere.
 
By taking the inputs and scenarios defined in the test IDE, he can transform that into a PL/SQL test package that automates the outcome checks, the running of the tests, and the evaluation of the results so all you have to worry about is ‘Yes this worked’ or ‘No this did not work and here is why’. When you get the ‘No’ answer, don’t despair, just jump into the debugger and run your scenario manually so you can see which line of code is causing the problem according to your expected set of outcomes.
 
Why write test code when Quest will do it for you?
 
Start Using This TODAY
 
Here’s your official Toad World homework assignment:
  1. Go to our PL/SQL testing community and watch some videos. If it looks as easy as I said it was, then proceed to assignment #2
  2. Download a trial, or if you must the freeware J
  3. Install it and try it out.
  4. Questions? Want to call shenanigans for real? Reply to this Blog or even better yet, talk to Steven here.
 
Permalink |  Trackback

Comment:
Add Comment   Cancel 
Search Blog Entries
 
Blogger and Topic List
 

 

All Recent Entries
 

 

Johannes Ahrends
Unicode

Steven Feuerstein
Oracle PL/SQL

Daniel Norwood
Toad for Data Analysts
John Pocknell
Toad for Oracle
Bert Scalzo
Toad for Oracle, Data Modeling, Benchmarking
Jeff Smith
Toad product family
Richard To
SQL Optimization
Jim Wankowski
DB2 - LUW and z/OS
John Weathington
Compliance
Doug Williams
Database Musings
  Henrik "Mauritz" Johnson
Toad Tips & Tricks on the "other" Toads
  Toad World Editor
Toad World issues

  Toad Data Modeler Opens in a new window
Data Modeling
 

Copyright 2008 by Quest Software  | Terms Of Use | Privacy Statement | Contact Us