PL/SQL Unit Testing

Does anyone know about PL/SQL unit testing software? I'm currently reviewing Quest's Code Tester for Oracle, which seems very good. Are there any others?

Check here my post
http://rodenthood.blogspot.com/2010/07/oracle-sql-developer-unit-testing.html
or here oracle's guide
http://www.oracle.com/technology/obe/11gr2_db_prod/appdev/sqldev/sqldev_unit_test/sqldev_unit_test_otn.htm

Similar Messages

  • Support for unit testing object types

    There's a Feature Request that suggests expanding the unit test tool to object types:
    Title
    Provide object type support for unit tests
    Description
    In the current version (2.1.0.63) I can perform only unit test for packages, function and procedures. But we use a lot of object types in the database and would like to test them. When is a support for object types scheduled?
    Average Rating
    10
    Development Comment
    This is planned for the next release.
    Status
    Scheduled for 3.0
    Although the status suggests inclusion in v3, in my current version 3.2.20.09 there is nothing.
    This is clearly an important issue for those who have voted for it as it scores a perfect 10 on average rating.
    Is there any sign of object types being supported in the 4.0EA1 release? There is a strong desire within my organisation to move to a more object-based approach to PL/SQL coding but until we are able to unit test easily there will be no real progress.

    If you are ready to learn a little bit of Ruby then you can try [PL/SQL unit testing with Ruby|http://blog.rayapps.com/2009/11/27/oracle-plsql-unit-testing-with-ruby/]. ruby-plsql library [supports also PL/SQL object types|http://blog.rayapps.com/2009/11/25/more-oracle-data-types-supported-by-ruby-plsql-gem/] as input and output parameters and return values.

  • How  to genearte Unit Test reports  through  ANT/Command  line ?

    Hi,
    I am using sql developer unit test feature to test my database code. I am planning to execute and generate reports by running ant script.
    Is it possible to get the unit test results in any format (text,XML,HTML) after running the tests.
    How to integrate report generation tasks as part of Automated builds?
    Is there any command line utility do through can invoke through ant task?
    Thanks,
    Fernando

    Fernando,
    I, too, am looking to run our PL/SQL unit test suites through our automated ant build scripts. Currently, I've only been able to determine that there is a "UtUtil.bat" and "UtUtil.sh" command line utility for win and linux in /sqldeveloper/sqldeveloper/bin. However, it only take three switches:
    UtUtil -run ?
    UtUtil -imp ?
    and
    UtUtil -exp ?
    While this does provide some limited value to us through automating the importing of our exported test suites and then running them as part of our builds, it doesn't help in running reports on the test runs and exporting the reports to something our build processes can consume (i.e. xml).
    Also, we want to be able to run our full db build on (almost) any of our development machines and we don't want to have to have a unit test repository already preconfigured on each development db. I haven't found a utility to automate the creation of the unit test repository user and the repository, and then whena all the test suite runs have finished and the reports run, delete the repository and repository user.
    We have used Quest's Code Tester product in the past and it had all of these great features that I am really hoping Oracle can either implement or expose to us.
    Regards and best of luck,
    Mike Sanchez

  • Unit Testing in PL/SQL

    Hi,
    I m writing some packages and in that some procedures are there. Now i want to test these procedures. I have downloaded utPLSQL from sourceforge.net
    But I am unable to use it. Do we need to copy those utPLSQL files where the orcale is present ? If so and after that do we need to run any .sql scripts before going to do Unit Testing.
    And please tell the procedure in brief in order to start Unit Testing.
    Thanks in Advance.

    I suggest you also check out Quest Code Tester for Oracle (disclosure: I design, build and use the tool - hey, I also wrote the original version of utPLSQL!), the first commercial automated testing tool for PL/SQL.
    www.quest.com/code-tester-for-oracle
    It generates virtually all of your test code, based on expected behavior you describe through a point and click interface. You can run tests through the UI or scheduled scripts.
    Regards,
    Steven Feuerstein
    www.ToadWorld.com/SF

  • SQL Developer 2.1: Problem exporting and importing unit tests

    Hi,
    I have created several unit tests on functions that are within packages. I wanted to export these from one unit test repository into another repository on a different database. The export and import work fine, but when running the tests on the imported version, there are lots of ORA-06550 errors. When debugging this, the function name is missing in the call, i.e. it is attempting <SCHEMA>.<PACKAGE> (parameters) instead of <SCHEMA>.<PACKAGE>.<FUNCTION> (parameters).
    Looking in the unit test repository itself, it appears that the OBJECT_CALL column in the UT_TEST table is null - if I populate this with the name of the function, then everything works fine. Therefore, this seems to be a bug with export and import, and it is not including this in the XML. The same problem happens whether I export a single unit test or a suite of tests. Can you please confirm whether this is a bug or whether I am doing something wrong?
    Thanks,
    Pierre.

    Hi Pierre,
    Thanks for pointing this out. Unfortunately, it is a bug on our side and you have found the (ugly) "work-around".
    Bug 9236694 - 2.1: OTN: UT_TEST.OBJECT_CALL COLUMN NOT EXPORTED/IMPORTED
    Brian Jeffries
    SQL Developer Team

  • SSDT: Creation of localDB instances from project file - Sql Server Unit testing purposes

    I have a SqlServer Database Project in my solution (VS2013 Professional) which has a corresponding test project with some stored procedure unit tests. Currently I am using a LocalDB and as far as I understand a local database instance is created in C:\Users\[User]\AppData\Local\Microsoft\Microsoft
    SQL Server Local DB\Instances\Projects and the specific .mdf file referenced in the SQL Server Object Explorer is in C:\Users\[User]\AppData\Local\Microsoft\VisualStudio\SSDT\[ProjectName]. The unit tests run fine on my local machine which I have developed
    the project on.
    My issue is we have a box which is configured to check out the project file from our version control, build the project using ms build commands and then run the unit tests using VSTest.Console. Usually with C# Test projects we reference the test project
    dll and the unit tests run fine. I have referenced the dll for the test project with the stored procedure unit tests in. 
    With the Stored Procedure unit tests however we get this exception: 
    Initialization method [project].[spTest].TestInitialize threw exception. System.Data.SqlClient.SqlException: System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. The specified LocalDB instance does not exist.
    After some digging I have realised that the localdb instance seems to be created when the project itself is created in VS not when it is built. Specifically when the localdb is first used and if you look into the appData folder of the test machine there
    is no corresponding mdf file for the project.  
    The question is is there a way to set up a localDB instance on the new machine if all you have the project file? The only purpose of the project on the test machine is to run the unit tests, no other development purposes. VS2013 Professional is installed
    on the test machine but a solution only using config file changes or MSBuild/VSTest commands would be preferable.
    I realise you could change the connection string to an actual test database and run the unit tests of that but we quite like the localdb approach for the testing. I also realise that you could potentially transfer the mdf file (haven't tested this solution)
    as well, though I would prefer if there is a solution to my initial question. 
    http://technet.microsoft.com/en-us/library/hh234692.aspx
    http://msdn.microsoft.com/en-us/library/hh309441(v=vs.110).aspx
    I have been reading up on LocalDB and I assume a automatic LocalDB is created when you create a sql server database project (ie on localdb first use). I have tried adding the database creation to the test project config file but do not really know where
    to go from there. The second link does not really specify when the named localdb will be created if you add the config items and I am not even sure if that is an actual solution.  Here's my test project config file for reference
    <configSections>
    <section name="system.data.localdb" type="System.Data.LocalDBConfigurationSection,System.Data,Version=4.0.0.0,Culture=neutral,PublicKeyToken=[PublicKeyToken]"/>
    <section name="SqlUnitTesting_VS2013" type="Microsoft.Data.Tools.Schema.Sql.UnitTesting.Configuration.SqlUnitTestingSection, Microsoft.Data.Tools.Schema.Sql.UnitTesting, Version=12.0.0.0, Culture=neutral, PublicKeyToken=[PublicKeyToken]" />
    </configSections>
    <system.data.localdb>
    <localdbinstances>
    <add name="SimpleUnitTestingDB" version="11.0" />
    </localdbinstances>
    </system.data.localdb>
    <SqlUnitTesting_VS2013>
    <DatabaseDeployment DatabaseProjectFileName="..\..\..\SimpleUnitTestDB\SimpleUnitTestDB.sqlproj"
    Configuration="Release" />
    <DataGeneration ClearDatabase="true" />
    <ExecutionContext Provider="System.Data.SqlClient" ConnectionString="Data Source=(localdb)\Projects;Initial Catalog=SimpleUnitTestDB;Integrated Security=True;Pooling=False;Connect Timeout=30"
    CommandTimeout="30" />
    <PrivilegedContext Provider="System.Data.SqlClient" ConnectionString="Data Source=(localdb)\Projects;Initial Catalog=SimpleUnitTestDB;Integrated Security=True;Pooling=False;Connect Timeout=30"
    CommandTimeout="30" />
    </SqlUnitTesting_VS2013>
    Thanks in advance for any response. Sorry if there is any misunderstanding, while I have been using VS to develop from the start, this is the first time I have used a Sql Server Database Project. 
    Regards,
    Christopher. 

    Yes, you can create a LocalDB instance manually. You use the SqlLocalDb utility, see here:
    http://technet.microsoft.com/en-us/library/hh212961.aspx
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Unit testing PL/SQL used in APEX application

    question from my customer :
    I am developing an application in Oracle Application Express and am working on unit tests for the PL/SQL stored procedures and packages that are stored in the underlying database and that are used by the APEX application. These unit tests should run within the SQL Developer Unit Test framework.
    The problem is that some of the PL/SQL code stored in the database uses functions like NV('APPLICATION_ITEM') to access items in the apex application. These do not return any values when I try to execute the PL/SQL within the unit test framework, ie through the backend. While it is good that the NV function does not error, NULL do not really work well in my scenario either (for example when the result of this functions is inserted into a NOT NULL column of a table). I can think of a few workarounds, such as creating my own NV function inside the test schema to return desirable values, but nothing seems a really satisfactory solution. I just wonder if there is any best practice recommendation from Oracle for this scenario - how can I run code that uses APEX-specific functions through the back end. I could not find anything in the APEX documentation for this but I'd be interesting to know if there is any recommendation how to best deal with this case.
    I am using SQL Developer version 4.0.0.13.80

    User[[:digit:]*
    Your PL/SQL Package APIs are poorly designed.
    You need to take Tom Kyte's quote to heart:
    "Application come and application go, but data remains forever"
    In short, you need to separate your database processing code (the stuff you need to unit test) from front-end/middle tier code.
    (repetitiveness is for effect.. not rudeness.)
    As such, The PL/SQL code that you need to 'UNIT TEST' must work without needing to run in APEX.
    The PL/SQL code that you need to 'UNIT TEST' must work without needing to run in .NET.
    The PL/SQL code that you need to 'UNIT TEST' must work without needing to run in JSP.
    The PL/SQL code that you need to 'UNIT TEST' must work without needing to run in Jive.
    The PL/SQL code that you need to 'UNIT TEST' must work without needing to run in Ruby.
    The PL/SQL code that you need to 'UNIT TEST' must work without needing to run in Perl::CGI.
    The PL/SQL code that you need to 'UNIT TEST' must work without needing to run in P9.
    The PL/SQL code that you need to 'UNIT TEST' must work without needing to run in <place latest and greatest thing here>.
    Again, I don't mean to sound rude.  I'm just trying to reinforce the idea that you need to separate database code from middle-tier/front-end stuff.
    Basically, you will need to separate all of your packages into multiple parts.
    a _CORE package (that will be unit tested) that does all the hard work
    an _APEX package for APEX infrastructure (this works with NV()/V(), etc.)
    a _NET package for .NET infrastructure when you need it
    a _JSP package for the JSP infrastructure when you need it
    a _JIVE package for the JIVE infrastructure when you need it
    a _<place latest and greatest thing here> for the <place latest and greatest thing here> when you need it.
    MK

  • Unit Test Variable Substitution in PL/SQL User Vailidation code not running

    Hi
    I am using new Unit Test Feature in SQL Developer 2.1.0.62.
    I have created a test implemented to test a function. The function has a VARCHAR2 parameter as input and returns a BINARY_INTEGER.
    I would like to perform 'Process Validation instead of specifying an explicit 'Result'. The check box 'Test Result' is unchecked.
    I have seen in the doc. that I can use substitution variables in my user defined PL/SQL code. I try
    IF {RETURNS$} < 0
    THEN ...
    but I always get the error
    ERROR
    <RETURN> : Expected: [Any value because apply check was cleared], Received: [-103]
    Validation User PL/Sql Code failed: Non supported SQL92 token at position: 181: RETURNS$
    Obviously, the program doesn't recognize {RETURN$}.
    Am I missing something?
    br
    Reiner

    Hi all,
    I have installed the latest version of SQL Developer (2.1.1) that fixed the problem - must have been a bug.
    The only problem was that I got an ORA-904 TEST_USER_NAME... error. I export my tests, dropped the repository, created a new one and reimported everything. Now it works as it should.
    br
    Reiner

  • Unit testing packages in sql developer

    It appears that the specify parameters window is blank for packaged functions which means the test call fails when run. Is this a grant or synonym issue ( or something similar ) or is there an issue with testing packages via the unit test interface of sql developer. Thanks in advance.

    Seems that you cannot right click on the packaged schema object from the schema connection i.e. you have to create the test from the unit test tab and then choose the object type i.e select packages and then the packaged function or procedure. This method results in the Specify Parameters window having the correct signature displayed. Procedures or methods can be created via the unit test tab or the active connection tab.

  • SQL Developer Unit Testing - Validation with PL/SQL

    Hi,
    I am trying to create Unit tests using SQL Developer UT framework.
    But when i am creating validation using User PL/SQL code option.
    Then how can i check value returned by l_count in code snippet below:
    -- Please raise an exception if the validation fails.
    -- For example:
    DECLARE
    l_count NUMBER;
    wrong_count EXCEPTION;
    BEGIN
    SELECT count(*) into l_count
    FROM test_recon
    WHERE
    match_num = 99836936
    AND Stg_status_flag <> 'E';
    IF l_count = 0
    THEN
    RAISE wrong_count;
    END IF;
    END;
    Also, can someone please refer me to few more demo examples (apart from oracle docs) to implement good test cases with SQL developer.
    I appreciate your help.
    Regards
    Dipali

    Probably not the answer you're looking for, but back when I was playing around with the Unit Test stuff, I didn't have sys privs, and the DBAs were a little busy at the time to set a up a repository for me. Rather than wait, I installed Oracle XE on my machine and created a small dev schema and deployed unit test to that. It's so much easier to perform quick proof of concepts when you have full control.

  • Using SQLCMD variables in SQL Server Unit Test Project

    Is it possible to use SQLCMD variables in my SQL Server Unit Test Project? In my test initialize script I'd like to set a database name variable, something like this:
    :SETVAR MyDatabase "mydatabase"
    SELECT * FROM [$(MyDatabase)].[mytable]
    but I get syntax errors when I run the test. Any suggestions how I can get this to work.
    Result Message: Initialization method
    myTest.TestInitialize threw exception. System.Data.SqlClient.SqlException: System.Data.SqlClient.SqlException:
    Incorrect syntax near ':'..

    Hi Kevin,
    What is the error?
    This should work only thing i could see is no scheme specified.
    SQL Server uses dbo as default schema.
    In your case:
    :SETVAR MyDatabase "mydatabase"
    SELECT * FROM [$(MyDatabase)].dbo.[mytable]
    Also check your instance collation if its Case sensitive then specify database and table name as exact case.
    Example:
    :SETVAR MyDatabase "[mydatabase]"
    :setvar schemavar "[dbo]"
    :setvar tablevar "[mytable]"
    SELECT * FROM $(MyDatabase).$(schemavar).$(tablevar)

  • SQL Developer 3.0 Unit Test

    Hi all,
    I'm hoping that one of you very knowledgeable individuals may be able to assist me!
    I'm an APEX developer, and I'm trying to make use of Hudson (www.hudson-ci.org) to automate my build process. I can successfully check files out of a source control repository and run them on my database, but I'm falling down when I try to use SQL Developer 3.0 from the command line to execute some unit tests.
    My test environment is a Windows XP SP3 machine running an 11g DB, APEX 4.1 and SQL Developer 3.0. In SQL Developer, I've set up a connection called APPHOME and currently, my unit test repository is on the same connection. If I open a command prompt and execute:
    C:\sqldeveloper\bin>ututil -run -suite -name TEST_PROCEDURE_SUITE -repo APPHOME -db APPHOME -log 1
    It works fine. The suite of tests execute OK, I get UT_SUCCESS back and when I look in SQL Developer, the result is there.
    However, if in a Hudson project I include an instruction that tries to fire exactly the same command, I get a response of: "Connection not found: APPHOME".
    Do I need to do anything special to ensure that ututil will be able to see the connection? The only thing that I can think of is that when I execute ututil from the command line, it does so as the logged in user (me, and I'm the one who has created the connections in SQL Developer) whereas when its fired by Hudson, it is executing as some other user that doesn't have my connections?
    Does anybody have any thoughts about this?
    Thanks in advance!
    Nick

    Hi Nick,
    I think your diagnosis is correct i.e. the connections are specific to your user. To resolve, you can try logging onto the Hudson server as the user that will run ututil, run up sqldeveloper client and import the connections into that user.
    I hope this helps.
    Philip Richens
    SQLDEV Development Team

  • SQL Developer 3.0 Unit Testing

    Hi folks,
    Firstly, let me say thanks for all the hard work that has gone into the improvements made in SQL Developer 3.0. I've been trailing EA3 for the past few days, and am so far very impressed.
    My development team are particularly interested in the improvements made to the Unit Test module. We have previously created a number of tests/test suites in 2.1, but when we select to connect to the old test case repository schema, 3.0 tells me that it can not find the repository. (Apologises, I do not have my development box in front of me, so I can't quote the exact message).
    Is there anything I can do to get it to recognise the old repository? I'd prefer not to have to recreate all of our existing tests...
    Thanks in advance,
    Nick

    Hi Mikka,
    Only simple PL/SQL Records are currently supported i.e. those that do not contain repeating or optional components and where all the components are themselves supported. This restriction is in place due to the fact that we use JDBC as the parameter passing mechanism which does not directly support the PL/SQL Record type.
    ANYTYPE and ANYDATA are not currently supported as they have a dynamic value type and therefore must be programmatically set. In the future, it may be possible to support these through the dynamic value and and validation features.
    This will remain so for the final version.
    Regards,
    Richard

  • SQL Developer 3 EA1: Unit test

    Hi,
    I just started using the unit test frame work in SQL Developer 3 EA 1 and I need some help defining a test case involving parent - child tables that are manipulated using a plsql API. The API for the child table requires the key of a record in the parent table. The parent record, and its key, is created by a test case startup process. The key is retrieved using a dynamic value query in the test implementation. It appears the dynamic value query is executed before the test case startup processes have been executed. Is this expected behaviour? My expectation is the startup processes are executed before the dynamic values query.
    Also, is it possible to use values from the startup processes as parameter values of the test case other than using a dynamic value query?
    Test case summary:
    2 Startup processes: The first deletes all data from parent and child tables. The second inserts in a record into the parent table.
    Zero Teardown processes.
    Test implementation: Dynamic value query that selects the key from the parent table and defines literals for the remaining parameters of the test case.
    1 Process validation: Test whether a record has been inserted into the childe table with the expected values.
    Thanks
    Alistair

    Hi Alistair -
    We execute the dynamic query to control how many times the test (start up, test case, validation, tear down) cycle executes.
    To get the behavior you want, put the test in a test suite and have the test suite start up do the table initialization for you.
    Brian Jeffries
    SQL Developer Team

  • Unit Test in SQL Developer 2.1: Automated Builds

    Hi,
    I am interested to know if the new Unit Testing framework can be accessed via API so the test execution is initiated from automated build process.
    Regards,
    Vadim

    I am having a problem with the unit testing command line.
    I am attempting to run the unit testing using the command line interface.
    I can connect to UNIT_TEST_REPOS schema in SQL developer.
    I am successfully running units test and suites in SQL developer.
    UNIT_TEST_REPOS, RCSV1 and DEVER users are granted on the UT_REPO_USER role and UNIT_TEST_REPOS and DEVER on the UT_REPO_ADMINISTRATOR.
    The following commands result in an error box saying "No Repository was found on the selected connection, you need to create a repository." (The HELP button apparently does nothing. The OK button closes the box.)
    C:\Program Files\sqldeveloper\sqldeveloper\bin>UtUtil -exp -test -name RCSV1_RCS_SECURITY.GET_LDAP_BASE -repo unit_test_repos -file c:\ut_xml\test.xml
    Unable to open repository
    C:\Program Files\sqldeveloper\sqldeveloper\bin>UtUtil -run -test -name RCSV1_RCS_SECURITY.GET_LDAP_BASE -repo unit_test_repos -db dever
    Unable to open repository
    C:\Program Files\sqldeveloper\sqldeveloper\bin>UtUtil -run -test -name RCSV1_RCS_SECURITY.GET_LDAP_BASE -repo dever -db dever
    Unable to open repository
    I would guess that I am not supplying the correct connection info.
    My last comment triggered an idea. It turns out that the connection names required are those connections named in SQL developer. In my case, they are not the same as the schema names. The following command worked as advertised.
    C:\Program Files\sqldeveloper\sqldeveloper\bin>UtUtil -run -test -name RCSV1_RCS_SECURITY.GET_LDAP_BASE -repo UNIT_TEST -db DeverLocal
    The ANT target is
    <target name="UnitTests">
    <exec executable="cmd" dir="${sqldev.bin.dir}">
    <arg value="/c"/>
    <arg value="UtUtil -run -suite -name RCSV1 -repo UNIT_TEST -db DeverLocal"/>
    </exec>
    </target>
    Regards,
    Bill

Maybe you are looking for

  • Cannot retrieve definition for form bean null

    Hi,           I have a page jsp which contains a form. This form contains an action           towards (page.do ).           I configured struts-config.xml file in whom I put a configuration of           action ( type=xxx.pageAction ) but not form bec

  • Bapi_document_create2 does not work correctly with attached file.

    Hi all. I hava a problem with bapi. I programmed below.         ls_docdata-documenttype = 'BBS'.         ls_docdata-description  = 'JJW test'.         ls_file-documenttype = 'BBS'.         ls_file-ORIGINALTYPE = 1.         ls_file-storagecategory = '

  • Can Check Number be start with zero?

    Dear all,                I knew that check number on SBO is numeric but check number of my country some number can start with zero and it effected to check number printing form. So, I'm not sure whether we can set check number to be charactor or not.

  • Save recorded name as a .wav file - Unity Connection v8.6

    I need to backup a user's greeting, but they just have their name recorded (in their own voice).  I know where to grab the standard greetings, alternate greetings, but not where to find the recorded name.  Can anyone assist?

  • Access Denied Error 0x80070005 under WinXP

    Dear All When I try to setup my computer with schedule tasks, I setup the "time" and "Day" and then click OK at this stage. I'm always asked for the password, but if I use the password or not I always receive the same message as following: **An error