For a tester, everything starts from its primary testing tool, its brain.
In my previous post I wrote about plsql-spec Ruby gem, my choice of weapon for testing Oracle technology. I started to test simple procedure that converts oracle DATE to character representation. For testing ideas I used this great post from test eye blog.
For a tester, time is very important source of testing ideas. Time was last added component to SFDPOT (mnemonic for San Francisco Depot) test strategy heuristic by James Bach.
I installed plsql-spec ruby gem on JRuby. JRuby uses Java as the underling virtual machine, while Ruby uses its own implementation written in C language. I used JRuby because my intention was to make testing infrastructure portable as much as possible. In order to connect to Oracle database, in JRuby you only need oracle jdbc driver, but pure Ruby requires Oracle Net Manager (which means for tester one more component to maintain) and oci8 gem.
My first testing session was to find the boundary of time supported in Oracle database.
Oracle Time range is [January 1, 4712 BC:December 31, 9999 AD].
Ruby Time class also supports BC years. For lower bound of supported Oracle DATE, just write:
plsql.bsn_eliste_pkg.to_tmstmp_tz( Time.local -4712, 1, 1 ,0, 0, 0 ).should eql "47120101000000 PNE"
where plsql procedure takes oracle DATE as input parameter. Python and Java lovers, parenthesis in Ruby are optional!
That code triggered following Java exception in JRuby:
Timestamp format must be yyyy-mm-dd hh:mm:ss[.fffffffff]
I am not able to send BC dates to plsql procedure! When I switched back to pure Ruby, I got following test fail:
Failure/Error: plsql.bsn_eliste_pkg.to_tmstmp_tz( Time.local -4712, 1, 1 ,0, 0, 0 ).should eql "47120101000000 PNE"
expected: "47120101000000 PNE"
In this case I revealed plsql procedure bug!
Your primary tool is your brain. Using your brain, you learn about testing by reading smart blogs (like test eye). You want to implement Time test ideas for Oracle procedures. You found out about plsql-spec ruby gem. There is an option, JRuby or Ruby. If one option is blocking you in implementing your testing ideas (like JRuby in this case) try another option. Choose your testing tools using your brain!
Labels: oracle, plsql, ruby