Testing PLSQL code

Hi guys
I working on project where in Oracle9i database there are 90 table and near about 200 triggers,Procedures and functions.My problem is I have to write test cases for all the triggers,Procedures and functions and give them to the Testerso that they can test it.Can Anybody tell me how to do that
Thanks in Advance
Vikramjit

This is not an Oracle thing, this is a general thing.
Rule 1: don't look at the code!
The testers should be considering whether the delivered application satisfies the requirements. Consequently, you need test cases to test what the developers should have written, not what they actually have written. Depending on how low-level your requirements go, you will need one or more test cases for each requirement.
Let's take an example. The application is an insurance claim system. The user requirement to be tested is "the system must print out cheques".
Okay, so we have a piece of system functionality that takes a claims number and optionally an amount; if the user enters an amount the printed cheque is for that amount, otherwise the cheque is for the full amount of the claim. If the cheque is for a partial amount, the amount due must be reduced according. The printed cheque must not exceed the amount due. The cheque printing routine must be able to handle the maximum allowable claim. Finally, remember to look after the pennies when drawing up your test data.
From that the following test cases suggest themselves.
Test Data
Claim No. 1234 for $850.00:
Claim No. 5678 for $850.00:
Claim No. 8888 for $888.88:
Claim No. 9999 for $99999999999999999999999999999.99:
1) Claim No = 1234, amount=100 => result is printed cheque for $100.00
2) Claim No = 1234, amount=null => result is printed cheque for $750.00
3) Claim No = 1234, amount=null => result is properly handled error, claim already paid
4) Claim No = 1234, amount=100 => result is properly handled error, claim already paid
5) Claim No = 5678, amount=0 => result is properly handled error, invalid amount
6) Claim No = 5678, amount=1000 => result is properly handled error, invalid amount
7) Claim No = 5678, amount=-100 => result is properly handled error, invalid amount
8) Claim No = 5678, amount=null => result is printed cheque for $850.00
9) Claim No = 3456, amount=100 => result is properly handled error, invalid claim no
10) Claim No. 9999, amount=null => result is printed cheque for $99999999999999999999999999999.99
11) Claim No = 8888, amount=444.44 => result is printed cheque for $444.44
12) Claim No = 8888, amount=null => result is printed cheque for $444.44
Notes
You will notice that some of these tests must be performed in a specific order. For instance, if you do test 2) before test 1) the expected results are different. However, it doesn't matter if you run test 10) before test 1). Also you have to be on top of your data: you need to know that there isn't a claim 3456 in order for test 10) to pass.
Once you've got beyond this sort of unit testing you need to think about how this requirement meshes with other requirements: for instance, "Cheques can only be printed by authorised users" and "Cheques can only be printed after a claim has had a pay-out authorised".
And so on. By now you may be thinking "This is like writing a program". If that is what you're thinking give yourself a gold star. Wouldn't it be nice if there was a programming language available that would allow you to write these test scripts and run them automatically? You're in luck. You only have to test the database - stored procedures and triggers - so you can use UTPLSQL. This is an open source test harness written in PL/SQL by saint in human form, Steven Feuerstein. It's fantastic. I advise you to check it out: http://utplsql.sourceforge.net/
Using a test harness like UTPLSQL requires some knowledge of the code, specifically which procedures implement which requirements and the signatures of those public procedures. That's all. Testing triggers is done by inserting/updating/deleting rows into the tables and then querying them. UTPLSQL can help with that too.
Good luck, APC

Similar Messages

  • ORA-01403: no data found Error in PLSQL code raised during plug-in processing.

    Hello OTN community,
    We are having the access to APEX problem. a New user was setup to access the APEX application. When I test to login as a new user, I get the message "ORA-01403: no data found Error in PLSQL code raised during plug-in processing.". When click OK to the disply message, the application will take me out of the sstem. I need help to even understand what is happening. I didn't develop the application, there is no documentation for this application, I am just supporting the application whenever there is a problem and I am new to APEX. As you can see I need help to figure this thing out. Your help is dearly appreciated.
    Thank you OTN

    Try to check the query that is executed and check if there is data or not

  • Publish a plsql code as webservice without using JDEVELOPER or APEX

    Hi All,
    I am looking into how can we publish a PLSQL code as web-service without using JDEV OR APEX.
    When I google for this one I can see only by using JDEV or APEX we can publish Code as a web-service.
    Is there any way in oracle, just by using simple PLSQL packages we can publish code as a webservice.
    Appreciate your response.
    Thanks,
    MK.

    Apex does not publish PL/SQL code as web services. It is a web run-time and development framework. Something totally different.
    To turn a PL/SQL function into a web service is simple. You use the orawsv servlet in XDB - without making a single code change to the function. It will not even know it is called as a web service.
    To use orawsv, two basic steps. Configure and enable the servlet (raw HTTP/HTTPS connections will be handled by the Listener). This also entails enabling shared server in the database, if not already enabled. The 2nd step is to allow the function to be executed (via a HTTP call) as a web service, via granting specific roles.
    orawsv handles the HTTP call. It provides the WSDL. It parses SOAP envelopes as input. It makes the call (as a standard PL/SQL call), to the function being used as a web service. It returns the results of the PL/SQL function call, as a SOAP envelope output.
    See Support Notes:
    How to Setup Native Oracle XML DB Web Services [Article ID 444191.1]
    Sample Framework for testing Native Oracle XML DB Web Services [Article ID 803794.1]
    How to Browse Native Oracle XML DB Web Services Example [Article ID 1324235.1]

  • Can anyone tell me what apple hardware test error code apple hardware 4MOT/4/40000002: Exhaust-1153 or 1209 means? I am running a MacBook Pro.

    Can anyone tell me what apple hardware test error code apple hardware 4MOT/4/40000002: Exhaust-1153 or 1209 means? I am running a MacBook Pro

    The motor on the exhaust fan has failed or is failing.

  • What are the meanings of Apple Hardware Test error codes 4m0t/4/40000003:hdd-1300 and 4m0t/4/40000003:hdd-1308?

    what are the meanings of Apple Hardware Test error codes 4m0t/4/40000003:hdd-1300 and 4m0t/4/40000003:hdd-1308?

    Thanks - Even though I'm years out of warranty I got chat help from Apple (I said they should help me since the codes aren't published.)  We covered three different questions, and although I didn't get a specific decoding of the error code, I got confirmation of what other comments here imply - it might have helped that I indicated I'd already been here - and useful links to how to do back ups, including to CD(s). (I don't have a lot of data on this computer yet)
    Now I need to figure out how to decide how hot-to-the-touch is "too hot" for the metal frame at the top of the iMac to decide whether I'm getting adequate fan performance or insufficient.  While chatting I initially reported it was cool at the bottom and warm at the top.  Apple hadn't asked, but their response prompted me to feel it again, and I'd say the top was hot, not warm - I updated but Apple didn't comment further except to conclude after addressing the other questions that I should take it in for further assessment - don't really want to bother with that.

  • How to write a file in unix server through oracle plsql code

    Hi All,
    My requirement is to create and write a file (any file for eg txt file) in unix box with in a specified directory through oracle plsql code.
    Oracle sits in windows server.
    using utl_file package we can create directory where oracle resides and write it there in oracle server in our case windows..
    But here we need to create,write a file but in unix server which is different server than where the oracle server resides..
    we are using Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    Can any one one please help me out in this issue...
    Thanks in Advance.
    Prakash

    Mr Prakash,
    Why are you asking this question multiple times in every forum you can spell?
    Valid responses have been presented to you already two times.
    Can you explain why you can't follow them up, but continue to abuse this forum by repeating doc questions?
    Sybrand Bakker
    Senior Oracle DBA

  • Displaying Images in a Report or in PLSQL Code

    Hi all,
    I have a products catelog in an items table (item_id, item_name, item_image (blob)). I want to display it in a table form but Reports in Portal30 do not allow images.
    I can write simple PLSQL code to display table contents in tabular form (using htp, htp packages) but I could not find any procedure/function to display image stored in a db table to an HTML table.
    I shall be grateful for any help or hint regarding this. You can mail me directly if you like.

    Armaghan
    This question is best asked in the Oracle9iAS Portal Applications Forum.

  • How to register a custom plsql code

    Hi
    i have wrritten a custom plsql code for my Overtime entries validation for payroll processing.
    Can any body tell me how to register it in application.
    Secondly i want to get the output file generated by report submission on my desktop.i want to know where the report output files for HR and payroll are stored so that i can get them through FTP.
    Regards

    if you want to integrate your plsql into a fast formula, please download the fast formula guide from metalink. Or ask your functional payroll consultant.
    All reports and processes in Oracle Apps are handled via concurrent programs and requests. When a concurrent request is finished, click on the output button, and depending from the filetype, your browser will take action.
    All concurrent output is also stored on the concurrent server. Ask your apps dba where she mapped the concurrent output directory. But i do not see why you should need this.

  • URGENT HELP: When some users submit, application carries empty fields from html components to plsql code

    Hi APEX users and developer, especially forum's active users, please get me rid of this problem because it is really very bad situation.
    I have a real trouble with application. It behaves unusual. Application is used by 60 users but only 3 of them have these problem and they can not use the application anymore.
    Application is
    http://apex.oracle.com/pls/apex/f?p=70547
    After fields are filled and some rows checked from tabular form in page, user submits the page. Process called newReyestr calls plsql procedure from package with inputs from page. But only same 3 users get empty fields in plsql code. I see it just after when the first line stepped in procedure.
    So, "what is the problem?"

    Hi NoGot,
    you know, I have not written big quote. The code was big. But it has no any meaning. Because problem is in first line. No need to understand it.
    There is no any difference between those users. They also tried it from different browser and even computers.
    BTW: I am not russian.

  • NLS issue in Java/PLSQL code [ using ROWID]

    I have NLS related question regarding the following scenario in Java/PLSQL code ::-
    OracleResultSet ors = (OracleResultSet) stmt.executeQuery("select rowId from t where t.col = 'XX'");
    // The above query could return multiple rowIds.
    String strVal1 = null;
    String strVal2 = null;
    if(ors.next())
    strVal1 = ors.getROWID(1).stringValue();
    if(ors.next())
    strVal2 = ors.getROWID(1).stringValue();
    ArrayList strList = new ArrayList();
    strList.add(strVal1);
    strList.add(strVal2);
    Now I need to pass a list of rowId's from Java to PLSQL function f().
    oracle.sql.ARRAY rowListArr = convertArrayListToRowPointerList(strList, conn) ;
    OracleCallableStatement cstmt = (OracleCallableStatement)
    cstmt.prepareCall("begin f(?); end;");
    cstmt.setObject(1, rowListArr);
    cstmt.execute();
    where:-
    static oracle.sql.ARRAY convertArrayListToRowPointerList(ArrayList arr, Connection conn)
    throws SQLException {
    oracle.sql.ArrayDescriptor stDesc = ArrayDescriptor.createDescriptor
    ("DBUSER.ROWPOINTERLIST", conn);
    oracle.sql.Datum[] keyVals= new oracle.sql.Datum[arr.size()];
    for(int i = 0; i < arr.size(); i++) {
    keyVals[i] = new oracle.sql.CHAR((String) arr.get(i),
    oracle.sql.CHAR.DEFAULT_CHARSET);
    oracle.sql.ARRAY keyArr = new oracle.sql.ARRAY(stDesc, conn, keyVals);
    return keyArr;
    and
    create or replace type DBUSER.ROWPOINTERLIST as table of varchar2(4000);
    Will there be NLS issues in the above code, where I pass the rowId content
    that I obtain from one query, as array of string bind variables to a subsequent PLSQL procedure? --- first approach
    Or
    do I need to pass the rowId list , as a array of oracle.sql.ROWID via bind variables? -- second approach
    The problem I have in second approach is that in the DB we cannot define a type as a table of ROWID's. So currently I have RowPointerList as a table of varchar2's (note the length of list of rowId is not predetermined in my case, so I user table instead of varray).
    However I was wondering if the first approach will have any NLS issues.
    Will appreciate your comments.
    Thanks

    ROWIDs are represented as either hex-encoded values or base64 encoded values. Both encodings use pure ASCII, so there should be no NLS issues.
    I am not very familiar with the oracle.sql.ARRAY type, but unless absolutely necessary, I would avoid the oracle.sql.CHAR datatype (assuming 10g drivers). Using java.lang.String is preferred.
    -- Sergiusz

  • How to call jsp in PLSQL code (to upload a file in IFS)

    Hello,
    We develop our PORTAL (9.0.2) with PL/SQL way.
    We want to make a form to upload file in IFS.
    We create a form like that :
    htp.formOpen(cmethod =>'post',
         cenctype => 'multipart/form-data',
         curl => '/pls/ptlcollab/ptlcollab.GestionDoc_screenbuilder.manipTableIFS',
         cattributes => 'name="ifs"') ;
    htp.TableData(htf.FORMFILE(cname=>'file', cattributes => 'size="25"')) ;
    The manipTableIFS procedure calls a loaded java procedure which called a servlet which work with IFS.
    BUT, modplsql seems to want we directly upload the doc in a table but we want to upload the doc in iFS !!!
    So, the solutiuon seems to call a jsp (or a servlet directly from our plsql code).
    BUT, how could I do that ???
    Any help would be greatly appreciated.
    Regards.
    Luc.

    Something along these lines ought to do what you want:
    <html>
    <body>
    <form name='foobar' action='foobar.jsp'>
    <script language='Javascript'>
    function askim() {
      if (confirm('Is you sure?')) {
        document.foobar.submit();
      } else return false;
    </script>
    <input type='button' value='Submit' onClick='askim()'>
    </form>
    </body>
    </html>
    Your mileage may vary.
    But the idea here is that the Javascript merely submits the form if the user clicks "OK" on the confirmation pop-up. Otherwise, nothing happens. The form is submitted to a JSP file which accepts the request, does something (such as call your Java class), then prints out some HTML in response.

  • Can i submit  a page and later execute a plsql code in some seperate page..

    I have a page.. this page has a button and the action for it is submit ..database action is insert activity..What i need is the moment
    i press the button .. after the submit activity has been done .. a plsql procedure which fires when i redirect to page.. 100 also be executed.
    Normally if my button action type is redirect to page .. Then this procedure gets executed...Since it is in redirected page.
    But If I change the action type... to submit this is not possible . ..Since the activity that occurs is the database insert activity..
    I also need the plsql code which is other page to be executed..
    Any information provided will be appreciated.

    i got it solved.. issue was..just
    needed to write a plsql code.. which will do a insert activity and then ..it does a redirect of page..I changed the button action from submit to link to page
    Issue is sorted
    Thanks

  • Hide or encrypt password in SQL/PLSQL code

    Hi,
    I need some help or suggestions to hide or encrypt database user password in SQL/PLSQL code. In our environment, we use a connect string with username/password for the JDBC connection. Our goal is to take out the password string and read it or pass it to the code on the fly.
    Thanks,
    Subroto

    So in the database somewhere you are storing username and password credentials? How do those credentials get sent to the Java application? Presumably, the Java application has to connect to the database, requiring a JDBC connection string, in order to query the table in order to get the username and password you've stored in the database.
    Assuming there are two different JDBC connection strings-- one in the Java application that connects to the database and a second that is stored in the database and used later by the Java application, who do you want to protect the data from? Do you want to protect it from other database users? Or do you want to protect it from the Java developers? Or something else?
    Justin

  • Which are the advantages of OWB Mappings over PLSQL code?

    Hi,
    I was wondering which are the advantages of OWB (10gr2 or 11g) Mappings vs simple PLSQL code when the mappings are, for performance reasons, only generated in set based mode.
    Regards
    Maurice

    I'd say it's the general benefits that an ETL tool is considered to have over hand crafted code e.g. maintainability and traceability. The latest versions of OWB also make it even easier to maintain TYPE2 dimensions etc.
    Of course benefits go the other way as well in that if you want the optimum performing code then a skilled PL/SQL developer will deliver that.
    Cheers
    Si

  • Passing message from plsql code to page

    Hello Everybody,
    I am trying to pass a 'success message' from plsql code which runs on page processing to the page. This plsql is a insert statement and if statement runs successfully (on submit) then I want to show a success message on the page after summit.
    Your comment and help would be appreciated.
    Thanks,
    Raj.

    Thank you Tony.
    Stored Procedure which I am calling on the page is running in database. So if this procedure runs successfully(or vice versa), how I would know?? Is there a way to pass value from database stored procedure to it's calling page?
    Following is procedure:
    procedure load_stateday_result(key_loc ATM_STATE_DAY_INSP.KEY_LOCATION%type) is
    temp_key_insp ATM_INSPECTION.KEY_ATM_INSPECTION%type;
    temp_key_location number(8);
    temp_dte_schedule date;
    begin
    temp_key_location := key_loc;
    select key_atm_inspection,dte_schedule into temp_key_insp, temp_dte_schedule
    from atm_inspection where
    key_location = temp_key_location and exam_type = 'D' and exam_yr = to_char(sysdate,'yyyy');
    insert into atm_state_day_insp(key_atm_state_day_insp,key_location,key_atm_insp,scheduled_dte)
    values(state_day_insp_seq.nextval,key_loc,temp_key_insp,temp_dte_schedule);
    COMMIT;
    EXCEPTION
    WHEN OTHERS THEN
    dbms_output.put_line('Error :'|| SQLCODE||':'||SQLERRM);
    --ROLLBACK;
    RAISE;
    end load_stateday_result;
    Will appreciate your reply.
    Thanks,
    Raj, NY

Maybe you are looking for

  • Unable to load metadata using outlineload utility in Hyperion planning classic app

    Hi All, We are trying to update metadata into classic planning application using outlineload utility, but we are facing error as given below:: at com.hyperion.planning.utils.HspOutlineLoad.main(Unknown Source) Error encountered with Database connecti

  • Retrieve messages in PI trough a specific tag

    Hi all, how do I retrieve a message using a specific tag in a XML? I would like to retrieve all the xml's that has the tag . How can I do this? Regards, Sérgio Salomã

  • Resaved PS colour images appear 'Negative' in Windows Explorer

    Hello, Bit of background info: I have just purchased a new Acer and 23" Samsung monitor last week. This morning Windows did an update and I noticed when I opened PhotoShop, the message 'Samsung - Natural Color Pro 1.0 ICM" appears defective'. I have

  • FCP will not open on my new iMac G5 (iSight)

    I have i have FCP 4.5 and just recently accquired a new 20" iMac G5 (iSight). I installed FCP on my new mac and it doesn't want to start up. I get a message that says "Configuration error: This software requires hardware or software which is missing.

  • After upgrade Digikam doesn't work .. missing libjpeg.so.7

    Hi all, After I upgraded to KDE 4.4 several things broke. As stated above DigiKam is missing libjpeg.so.7, this version of the lib is no longer supplied. The version I have on my system is now libjpeg.so.8 (after a full system upgrade) The version of