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.

Similar Messages

  • SQL Developer Unit Test

    I'm trying out the Unit Test tool in SQL Developer version 3.2.09 and I keep getting the following error on the Teardown Process:
    Teardown Table or Row Restore (1/1) failed: ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    ORA-06512: at line 22
    I have no idea what line 22 refers to? I cannot seem to find more detailed information in order to correct the problem.
    Any insight or help would be great!
    Thanks,
    Paul

    I'm having the same issue with SQL Developer 3.2.20.09 on Oracle 11.2.0.3.0. However, I think it's somewhat data dependent as I've had success and I've also encountered the ORA-06502 error.
    I ran a generic test on a very simple table and was successful using the teardown restore of the table. The procedure isn't important in this scenario, but is given as reference to creating the test. The simple, successful case is given first.
    Note that in both cases/tests, the original table of data already existed, so I question the error message pointing to data being inserted is longer than the field allows or that data types are somehow different...+unless+ SQL Developer is translating or getting it wrong. ALSO NOTE, running the SQL inserts as given works if run through the worksheet. It's only in the Teardown that I see the ORA-06502 error message.
    Data
    CREATE TABLE EMPLOYEES (EMPLOYEE_ID NUMBER, COMMISSION_PCT NUMBER, SALARY NUMBER);
    Insert into EMPLOYEES (EMPLOYEE_ID,COMMISSION_PCT,SALARY) values (1001,0.2,8400);
    Insert into EMPLOYEES (EMPLOYEE_ID,COMMISSION_PCT,SALARY) values (1002,0.25,6000);
    Insert into EMPLOYEES (EMPLOYEE_ID,COMMISSION_PCT,SALARY) values (1003,0.3,5000);
    CREATE OR REPLACE PROCEDURE AWARD_BONUS AS
    BEGIN
    null;
    END award_bonus;
    Startup: Table or Row Copy
    description = "TMP$AWARD_BONUS_TEST" := SELECT ROWID AS SRC$ROWID, s.* FROM "EMPLOYEES" s
    source = "EMPLOYEES"
    temp = "TMP$AWARD_BONUS_TEST"
    Teardown: Table or Row Restore
    description = "TMP$AWARD_BONUS_TEST" -> "EMPLOYEES"
    source = "EMPLOYEES"
    key = PRIMARY KEY
    temp = "TMP$AWARD_BONUS_TEST"
    The above worked without error.
    The following did not work.* (Again, the procedure isn't relevant.)
    Data
    CREATE TABLE "xxdss_fact_detail_history"
    "fact_trx_id" NUMBER(15, 0),"number_of_records" NUMBER,
    "product_code" VARCHAR2(250 byte),"item_code" VARCHAR2(250 byte),
    "item_description" VARCHAR2(250 byte),"trade" VARCHAR2(250 byte),
    "item_system" VARCHAR2(250 byte),"unit" VARCHAR2(250 byte),
    "fuel_source" VARCHAR2(250 byte),"component" VARCHAR2(250 byte),
    "assembly" VARCHAR2(250 byte),"part" VARCHAR2(250 byte),
    "symptoms" VARCHAR2(250 byte),"diagnosis_item" VARCHAR2(250 byte),"coa"
    VARCHAR2(250 byte),"cchs_parts" VARCHAR2(250 byte),
    "region" VARCHAR2(250 byte),"state" VARCHAR2(250 byte),
    "county" VARCHAR2(250 byte),"zip" VARCHAR2(250 byte),"vendor_id" NUMBER,
    "vendor_site_id" NUMBER,"vendor_name" VARCHAR2(250 byte),
    "vendor_site" VARCHAR2(250 byte),"c_service_call_cost" NUMBER,
    "c_labor_cost" NUMBER,"c_part_cost" NUMBER,"c_tax" NUMBER,
    "c_cchs_oh_cost" NUMBER,"c_cchs_total_low_cost" NUMBER,
    "c_cchs_total_high_cost" NUMBER,"c_cchs_avg_total_cost" NUMBER,
    "c_nc_c_labor_cost" NUMBER,"c_nc_c_part_cost" NUMBER,"c_nc_tax_cost" NUMBER
    ,"c_nc_total_low_cost" NUMBER,"c_nc_total_high_cost" NUMBER,
    "c_nc_avg_total_cost" NUMBER,"c_flat_low_cost" NUMBER,
    "c_flat_high_cost" NUMBER,"c_flat_avg_cost" NUMBER,
    "p_cycle_time_day_low" NUMBER,"p_cycle_time_day_high" NUMBER,
    "p_cycle_avg_time_day" NUMBER,"p_reasgn_low" NUMBER,"p_reasgn_high" NUMBER,
    "p_reasgn_avg" NUMBER,"p_recall_low" NUMBER,"p_recall_high" NUMBER,
    "p_recall_avg" NUMBER,"s_sp_nps_score_low" NUMBER,
    "s_sp_nps_score_high" NUMBER,"s_sp_avg_nps_score" NUMBER,
    "s_cchs_nps_score_low" NUMBER,"s_cchs_nps_score_high" NUMBER,
    "s_cchs_avg_nps_score" NUMBER,"cps_cost" NUMBER,"cps_perfrmce" NUMBER,
    "cps_sat" NUMBER,"coa_score" NUMBER,"comments" VARCHAR2(4000 byte),
    "complete_flag" VARCHAR2(1 byte),"last_update_date" DATE,
    "last_updated_by" NUMBER(15, 0),"creation_date" DATE,
    "created_by" NUMBER(15, 0),"last_update_login" NUMBER(15, 0),
    "vendor_number" VARCHAR2(200 byte)
    SET DEFINE OFF;
    Insert into XXDSS.XXDSS_FACT_DETAIL_HISTORY (FACT_TRX_ID,NUMBER_OF_RECORDS,PRODUCT_CODE,ITEM_CODE,ITEM_DESCRIPTION,TRADE,ITEM_SYSTEM,UNIT,FUEL_SOURCE,COMPONENT,ASSEMBLY,PART,SYMPTOMS,DIAGNOSIS_ITEM,COA,CCHS_PARTS,REGION,STATE,COUNTY,ZIP,VENDOR_ID,VENDOR_SITE_ID,VENDOR_NAME,VENDOR_SITE,C_SERVICE_CALL_COST,C_LABOR_COST,C_PART_COST,C_TAX,C_CCHS_OH_COST,C_CCHS_TOTAL_LOW_COST,C_CCHS_TOTAL_HIGH_COST,C_CCHS_AVG_TOTAL_COST,C_NC_C_LABOR_COST,C_NC_C_PART_COST,C_NC_TAX_COST,C_NC_TOTAL_LOW_COST,C_NC_TOTAL_HIGH_COST,C_NC_AVG_TOTAL_COST,C_FLAT_LOW_COST,C_FLAT_HIGH_COST,C_FLAT_AVG_COST,P_CYCLE_TIME_DAY_LOW,P_CYCLE_TIME_DAY_HIGH,P_CYCLE_AVG_TIME_DAY,P_REASGN_LOW,P_REASGN_HIGH,P_REASGN_AVG,P_RECALL_LOW,P_RECALL_HIGH,P_RECALL_AVG,S_SP_NPS_SCORE_LOW,S_SP_NPS_SCORE_HIGH,S_SP_AVG_NPS_SCORE,S_CCHS_NPS_SCORE_LOW,S_CCHS_NPS_SCORE_HIGH,S_CCHS_AVG_NPS_SCORE,CPS_COST,CPS_PERFRMCE,CPS_SAT,COA_SCORE,COMMENTS,COMPLETE_FLAG,LAST_UPDATE_DATE,LAST_UPDATED_BY,CREATION_DATE,CREATED_BY,LAST_UPDATE_LOGIN,VENDOR_NUMBER) values (324,2,'L&F-MPP03TR','STCOL-SPL','Straight Cool Split System','HVAC',null,'STCOL-SPL',null,null,null,null,null,null,'REAPIR','N',null,'VA','ASHBURN','20148',22024,118957,'Air Lingus Inc',null,50,55,44,12,180,40,78,76.5,60,50,20,100,180,130,50,110,80,2,8,3.9323148148178,40,60,43,9,10,8.2,100,201,150,20,40,35,50,30,20,100,null,null,to_date('01-JAN-13','DD-MON-RR'),1,to_date('01-JAN-13','DD-MON-RR'),1,null,'122023');
    Insert into XXDSS.XXDSS_FACT_DETAIL_HISTORY (FACT_TRX_ID,NUMBER_OF_RECORDS,PRODUCT_CODE,ITEM_CODE,ITEM_DESCRIPTION,TRADE,ITEM_SYSTEM,UNIT,FUEL_SOURCE,COMPONENT,ASSEMBLY,PART,SYMPTOMS,DIAGNOSIS_ITEM,COA,CCHS_PARTS,REGION,STATE,COUNTY,ZIP,VENDOR_ID,VENDOR_SITE_ID,VENDOR_NAME,VENDOR_SITE,C_SERVICE_CALL_COST,C_LABOR_COST,C_PART_COST,C_TAX,C_CCHS_OH_COST,C_CCHS_TOTAL_LOW_COST,C_CCHS_TOTAL_HIGH_COST,C_CCHS_AVG_TOTAL_COST,C_NC_C_LABOR_COST,C_NC_C_PART_COST,C_NC_TAX_COST,C_NC_TOTAL_LOW_COST,C_NC_TOTAL_HIGH_COST,C_NC_AVG_TOTAL_COST,C_FLAT_LOW_COST,C_FLAT_HIGH_COST,C_FLAT_AVG_COST,P_CYCLE_TIME_DAY_LOW,P_CYCLE_TIME_DAY_HIGH,P_CYCLE_AVG_TIME_DAY,P_REASGN_LOW,P_REASGN_HIGH,P_REASGN_AVG,P_RECALL_LOW,P_RECALL_HIGH,P_RECALL_AVG,S_SP_NPS_SCORE_LOW,S_SP_NPS_SCORE_HIGH,S_SP_AVG_NPS_SCORE,S_CCHS_NPS_SCORE_LOW,S_CCHS_NPS_SCORE_HIGH,S_CCHS_AVG_NPS_SCORE,CPS_COST,CPS_PERFRMCE,CPS_SAT,COA_SCORE,COMMENTS,COMPLETE_FLAG,LAST_UPDATE_DATE,LAST_UPDATED_BY,CREATION_DATE,CREATED_BY,LAST_UPDATE_LOGIN,VENDOR_NUMBER) values (465,4,'L&F-MPP03TR','STCOL-SPL','Straight Cool Split System','HVAC',null,'STCOL-SPL',null,null,null,null,null,null,'REPLACE','N',null,'VA','ASHBURN','20148',1768,1090523,'Airmax Heating And Air Conditioning Llc',null,65,50,80,15,110,50,60,70,70,40,20,100,180,130,50,110,80,3,5,0.878969907411374,10,70,20,1,2,2,130,150,140,20,40,60,40,30,30,100,null,null,to_date('01-JAN-13','DD-MON-RR'),1,to_date('01-JAN-13','DD-MON-RR'),1,null,'101767');
    CREATE OR REPLACE PROCEDURE dss AS
    BEGIN
    null;
    END dss;
    Startup: Table or Row Copy
    description = "TMP$DSS_TEST" := SELECT ROWID AS SRC$ROWID, s.* FROM "XXDSS_FACT_DETAIL_HISTORY" s
    source = "XXDSS_FACT_DETAIL_HISTORY"
    temp = "TMP$DSS_TEST"
    Teardown: Table or Row Restore
    description = "TMP$DSS_TEST" -> "XXDSS_FACT_DETAIL_HISTORY"
    source = "XXDSS_FACT_DETAIL_HISTORY"
    key = PRIMARY KEY
    temp = "TMP$DSS_TEST"

  • Variable substitution in Unit Testing validation - Date format?

    Using SQL Developer unit testing, I am having difficulty comparing Date datatype in a validation.
    I use a Dynamic Value Query to set the parameters of an insertion procedure under test.
    select * from (select doc_nbr as p_mstr_doc_nbr, doc_nbr as p_assoc_doc_nbr, sysdate as p_date_added from documents sample(0.01) order by dbms_random.random)  where rownum <= 1;So P_DATE_ADDED is a DATE datatype.
    I wish to validate that the insertion was correct. So I run a Process Validation returning one or more rows.
    SELECT * FROM X100_ASSOC
      WHERE MSTR_DOC_NBR = '{P_MSTR_DOC_NBR}'
        AND ASSOC_DOC_NBR = '{P_ASSOC_DOC_NBR}'
        AND to_char(DATE_ADDED,'dd-MON-yy HH24:MI:SS')  = {P_DATE_ADDED};I understand that the {P_DATE_ADDED} is substituting in a string. From Help page :
    "What is actually substituted is the string representation of the parameter value. For example:
    If P1 is a parameter of type NUMBER and has the value 2.1, the string {P1} will be replaced by the string 2.1.
    If P1 is a parameter of type VARCHAR2 and has the value ABC, the string '{P1}' will be replaced by the string 'ABC'. (Note the single-quotation marks around {P1} in this example.)"
    I need to know the format that the date is cast into as a string. Then I can do the comparision on the where clause.
    Any answers? or details of where is more in depth documentation?
    Thank you,
    Bill

    I agree as a general rule. However in this case, it appears that the variable substitution routine is returning the default format. So to compare my expected data to the returned data I choose to use the default format. If the variable substitution routine specified an explicit format, I would use that. In my original question, I asked if anyone knew the format.
    Regards,
    Bill

  • SQL Developer: Failure -Test failed: IO Error: Got minus one from a read ca

    SQL Developer: Failure -Test failed: IO Error: Got minus one from a read call
    Hi,
    I am sorry I know this is probably most frequently asked question, but I have no idea what I should be searching for.
    I looked up the error above to see if i could find a solution, but unfortunately I did not.
    Right Let me start of with I am a Total Noob.. well it terms of having to install Oracle 11g myself.
    In my University they hosted a database, and assigned us a User & pass thats how I have been using SQL Developer,
    but since I am not longer a university student. I need to use Oracle Database.
    So I downloaded Oracle 11g Enterprise Installed it on my laptop that i don't use much.
    Name the Database: Rudu
    It did all the installation, and seemed to have succeeded, I went on to the https://localhost:1158/em (Though am not sure why em? whats the deal with that? I thought it would be https://localhost:1158/Rudu) anyways....
    Logged in using the System user.
    Went to Users and created a user called: RUDUHR
    Thought yeah its working... went on to my other laptop opened up SQL Developer.
    Created Connection with the following Settings
    Con Name: RK
    User: RUDUHR
    Pass: TEST
    Con Type: Basic
    Role: Default
    Hostname: 192.168.0.8
    Port: 1158
    SID: Rudu
    It don't work though Why is that??????
    192.168.0.8 is laptop that has oracle 11g installed and running.
    I even tried using SYSTEM user to connect, but same error
    also tried changing SID to em, it made no difference I keep getting the error Status: Failure -Test failed: IO Error: Got minus one from a read call
    So ya am clueless... LOL I only know how to create tables and stuff not how to configure a Database.
    and just so you know I did forward the port on me router to correct laptop.

    It don't work though Why is that??????
    192.168.0.8 is laptop that has oracle 11g installed and running.
    It is because you don't read documentation.
    1158 is the default port for Enterprise Manager
    1521 is the default port for Sqlnet.
    Your port number is incorrect.
    Needless to say, you can create your tables in EM too.
    As per the Forums Etiquette post (first link when you get to this page) it is recommended you read documentation before asking Yet Another Doc Question.
    Sybrand Bakker
    Senior Oracle DBA

  • SQL Developer: Failure -Test failed: IO Error: Network Adapter No Conn

    SQL Developer: Failure -Test failed: IO Error: The Network Adapter could not establish the connection
    Hi,
    and sorry this is a really common questions and yes I did do a search, but I don't understand it.
    First let me just tell you that Oracle 11g is installed on my second laptop on the same Network.
    Secondly I can connect to the Database using Oracle SQL Developer on the laptop Oracle 11g is installed on.
    The problem is I want to connect to the database on my main Laptop.
    I put in the correct details Hostname 192.168.0.8 ( this is the laptop oracle is installed and running on)
    Port 1521
    SID dbarudu
    ****** YES I HAVE PORT FORWARDED
    ****** YES I HAVE ALLOWED 1521 on the FIREWALL
    ****** YES I HAVE EVEN SWITCHED OFF THE FIREWALL
    Now one more thing you should know ... I don't know nothing about Oracle Servers ok.... so I have just installed Oracle 11g Enterprise and thought done it should be working now.
    I just need to use oracle db for a project.
    So keep in mind I am a total noob and terms like TNSPING etc mean absolutely nothing to me.
    So please help, but help with step by step guide on how to get Oracle to let me have access from another computer.

    If the Listener is working, then you should not get the error SQL-Developer error you are reporting.
    The listener typically runs using the hostname and port 1521. This means it opens tcp port 1521 on all IP addresses of that platform.
    The database server by default will register itself with the local listener. Thus the listener will know the database SID, the database services, whether there are dispatchers to support shared server connections and so on.
    The client side needs simply to specify 3 pieces of data to connect:
    - the IP of the database server
    - the tcp port of the listener
    - a database identifier (such as Oracle SID or service name) to connect to
    It is really that simple.
    If this does not work, the problem falls into 2 broad categories:
    a) incorrect installation and configuration of the Oracle software (the out-of-the-box install works unless messed up)
    b) some kind of networking issue
    To troubleshoot any problem means reducing the complexity of the problem, eliminating multiple moving parts and focusing on specific ones, in order to isolate the problem.
    For your problem, this will go something as follows:
    - does the listener run? (check if the service is running and whether tcp connections are accepted on the listener port - telnet can be used for the latter)
    - does the database successfully registers itself with the listener? (check the services command of the listener and relevant db initialisation parameters)
    - does a local TNS (tcp network) connection work on that server? (use SQL*Plus and test on that platform client-server connectivity via tcp to the listener)
    - does the client platform have connectivity with the server platform? (use ICMP and telnet to test)
    - repeat the TNS test on the client platform using the same working TNS tested on the server platform
    Do not use JDBC to test the connection - keep it simple and use sqlplus and the standard Oracle Call Interface (OCI). A full client version of the OCI plus sqlplus can be downloaded under the Oracle InstantClient downloads.
    Finally - if you expect to simply install and use Oracle, then use the correct version. Oracle Express Edition aka Oracle XE. Installs and works out-of-the-box. The only manual config change to make is (as far as I recall) to run the listener on all IP addresses of that platform. And this required editing the listener.ora file, changing the HOST parameter and restarting the listener.
    Also keep in mind that you have not presented an Oracle error code and Oracle error message. But a client application error message. And that message is pretty much meaningless - it does not point to a specific Oracle networking or Oracle server problem. To diagnose that, we expect a TNS or ORA error number.

  • SQL Server Unit Tests

    Hi SQL Server Experts,
    About SQL Server Unit Tests (vide
    http://msdn.microsoft.com/en-us/library/jj851203(v=vs.103).aspx), please help with inputs on pros and cons of SQL Server Unit Tests. Any ideal recommendation?
    Thanks

    Blog on the topic: "Database unit testing is used for feature testing of your individual modules (stored procedures, triggers or user defined functions) that is to say your module performs as expected.  Apart from that, it is also used to ensure that
    subsequent changes to the module does not break any functionality.
    At first glace, it looks like this would add overhead to create vs. doing adhoc testing, but Visual Studio lets you automatically generate T-SQL code stubs to test the database object which you can customize as per your need.
    Visual Studio provides Database Unit Test Designer which you can write/define T-SQL scripts (also insert SQL assertion in this code) that calls your module and then evaluates the execution result against the different test conditions which indicates your
    modules execution success or failure."
    LINK:
    SQL Server Unit Testing with Visual Studio 2010
    >Please pardon my ignorance as I am coming back to SQL Server after a brief gap.
    You may have to brush up with T-SQL prior to using a sophisticated tool like this:
    http://www.sqlusa.com/bestpractices/
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Design & Programming
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Is there any known problem using Oracle SQL Developer 3.0.04 with Java 1.7?

    I'm new to Oracle. I have installed Oracle SQL Developer 3.0.04 and Java 1.7. When I run Oracle SQL Developer, I will get the window Running this product is supported with minimum Java version of 1.6.0_04 and a maximum version less than 1.7. This product will not be supported....
    Is there any known problem using Oracle SQL Developer 3.0.04 with Java 1.7?
    I have already downloaded Java 1.6 but don't know whether I need to uninstall Java 1.7 first. If don't need to uninstall Java 1.7, how can I set Oracle SQL Developer to run with Java 1.6?
    Thanks for any help.
    Edited by: 881656 on Aug 25, 2011 11:22 AM

    Hi,
    One prior post discussing the use of Java 7 is:
    SQL Developer 3.0  and Java SE 7?
    There is no need to uninstall any Java version (except if you have disk space constraints) and no problem switching between Java versions. This may be controlled in the sqldeveloper.conf file in your ...\sqldeveloper\sqldeveloper\bin directory via the SetJavaHome line. For example:
    #SetJavaHome ../../jdk
    SetJavaHome C:/Program Files/Java/jdk1.6.0_26
    #SetJavaHome C:/Program Files/Java/jdk1.7.0Regards,
    Gary Graham
    SQL Developer Team

  • 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)

  • Can SQL Developer Data Modeler work with OBIEE?

    Can SQL Developer Data Modeler work with OBIEE? Can we export the data model from the Data Modeler and import it into OBIEE? Or export the OBIEE metadata to the Data Modeler for Data Model defining?

    no
    Philip

  • SQL Developer - Adding a column comment via SQL

    When I add a comment in SQL*Plus via SQL, such as COMMENT ON COLUMN "MY_OWNER"."MY_TABLE"."MY_COLUMN" IS 'column comment' it works fine. When I try the same thing in SQL Developer I receive a message "No SQL statement entered".
    I realize this can be done in SQL Developer via action buttons in the user interface; but I need to be able to do it via SQL since my procedure generates this code for hundreds of columns at one time.
    Is there a SQL way to do this in SQL Developer? Alternatively, can SQL Developer call SQL*Plus to run commands?

    This is a current bug when executing as statement (F9).
    Good news is it does work when running as script (F5).
    Have fun,
    K.

  • Unit Test exports between different SQL Developer versions

    Hi,
    I am having problems with trying to export and import unit test suites between SQL Developer versions. I can't find any documentation in this area. We have a number of unit test suites exported as XML files from version 2.1.1.64, and below are combinations of things I have tried:
    - I have tried to import a unit test suite into version 3.0.0.4 that was exported from version 2.1.1.64 and get the error "Import failed. unexpected null value". I expect that this is probably an unsupported action due to repository changes between the two versions - should I be able to do this?
    - I have upgraded the repository with unit tests in it. The unit tests run perfectly well in the upgraded repository. However, if I try to export any suites or individual tests, I get an error "Export failed.". A XML file is created but with what looks like only the header part of it.
    - I have created a new unit test suite in version 3.0.0.4 and this exports successfully.
    - I have gone into each test of a suite in the upgraded repository and made a change so that I can perform a commit. When I do an export, this does then work successfully.
    Therefore it appears that something is not carried out by default when the repository is upgraded, but this fixes itself if the test is amended and committed in the upgraded repository. Although this may be a workaround, we have 100's of tests and is not something I really want to do. Has anyone else experienced this and got any recommendations for this?
    Thanks, Pierre.

    Hi,
    I am having problems with trying to export and import unit test suites between SQL Developer versions. I can't find any documentation in this area. We have a number of unit test suites exported as XML files from version 2.1.1.64, and below are combinations of things I have tried:
    - I have tried to import a unit test suite into version 3.0.0.4 that was exported from version 2.1.1.64 and get the error "Import failed. unexpected null value". I expect that this is probably an unsupported action due to repository changes between the two versions - should I be able to do this?
    - I have upgraded the repository with unit tests in it. The unit tests run perfectly well in the upgraded repository. However, if I try to export any suites or individual tests, I get an error "Export failed.". A XML file is created but with what looks like only the header part of it.
    - I have created a new unit test suite in version 3.0.0.4 and this exports successfully.
    - I have gone into each test of a suite in the upgraded repository and made a change so that I can perform a commit. When I do an export, this does then work successfully.
    Therefore it appears that something is not carried out by default when the repository is upgraded, but this fixes itself if the test is amended and committed in the upgraded repository. Although this may be a workaround, we have 100's of tests and is not something I really want to do. Has anyone else experienced this and got any recommendations for this?
    Thanks, Pierre.

  • 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]

  • SQL Developer autoformating text values with hypen (-)

    Hi
    This happens in SQL Developer. The version which I use is 2.1.0.63
    When I insert a varchar2 value to a column in the table, if there is a hyphen in the text and if there are empty lines in the text, the empty lines are lost. If there is no hyphen, it works fine.
    Below is an eg:
    Create table test (error Varchar2(500));
    Insert into test values ('This
    is
    a
    test
    Select * from test;
    The result copied to a notepad is below
    This
    is
    a
    test
    Now remove the hypen from the text and insert the record
    The result copied to a notepad is below
    This
    is
    a
    test
    Can anyone explain me why this is happening. I have a lot of text with hyphen and almost all my records are auto-formatted by sql developer.
    any help is appreciated.
    Warm Regards
    -Georgey
    Edited by: 859895 on Jul 7, 2011 4:14 PM

    So, I'm just checking this in 3.1 and it looks fine to me.
    drop table test ;
    Create table test (error Varchar2(50));
    Insert into test values ('This
    is
    a
    test
    Insert into test values ('This
    is
    a
    test
    select rownum, length(error) from test;
    select * from  test;gives this on the f5 output
    table TEST dropped.
    table TEST created.
    1 rows inserted.
    1 rows inserted.
    ROWNUM LENGTH(ERROR)
         1            25
         2            37
    ERROR                                           
    This                                              
    is                                                
    a                                                 
    test                                              
    This                                              
    is                                                
    a                                                 
    test                                              
           In F9, if you edit the col value, the data is intact. It looks like the cell renderer compresses space down for viewing purposes.
    Thanks
    Barry

  • Problem connecting SQL Developer 1.5.1 with Subversion 1.5 (win XP)

    Hi I'm trying to connect the latest version of SQL Developer 1.5.1 to an svn version 1.5 repository.
    I'm on a win XP machine. (svn is on Linux red hat)
    The error I see is;
    Testing read access for repository svn://<xxxxxxxxxxx>/var/svn...
    svn: Malformed network data
    svn: Malformed network data
    Access refused.
    I'm able to connect to other (older versions of svn) repositories.
    I notice that SQL Developer uses SVNkit 1.1.6. and I have a feeling that this is not compatible with svn 1.5
    Has anyone encountered this problem or has anyone successfully connected SQL DEV 1.5.1 to SVN 1.5?
    Regards,
    Patrick
    note: the svn repository is a source code repository. (.java .class and .sql files.)
    there is no DB data there, and no DB schema. (other than in the .sql files)
    I'm saying this because I'm not an SQL specialist, (and even then, I'm mainly mysql!) and I seem to get the impression that source control to SQL guys might mean something slightly different. i.e. versioning a DB rather than the source code that creates a DB. If I'm wrong about this, apologies! ;)
    Message was edited by:
    user651051

    note: the svn repository is a source code repository. (.java .class and .sql files.)
    there is no DB data there, and no DB schema. (other than in the .sql files)
    I'm saying this because I'm not an SQL specialist, (and even then, I'm mainly mysql!) and I seem to get the impression that source control to SQL guys might mean something slightly different. i.e. versioning a DB rather than the source code that creates a DB. If I'm wrong about this, apologies! ;)There are arguments both ways, but the current implementation in SQLDeveloper only supports version control on source files. IMO there needs to be a link between the vc repository, the source file you are working on and the object it creates in the database.
    As it stands, you can edit and compile a procedure in the database, but if you don't remember to extract it back to its source file, you end up with a mismatch. Similarly, if you edit the source file and forget to run it into the database you end up with a mismatch.

  • Sql developer won't connect with SQL server database on cluster

    Hello,
    I have a microsoft SQL server database on a windows cluster. Name for this cluster is like XXX/YYY
    When I try to connect to this database with SQL developer, I get a failure, mentioning:
    "Status : Failure -Cannot connect to Miscrosoft SQL Server on XXX/YYY"
    As far as I know, I have installed the correct jtds driver (version 1.2.5), since I can connect to sql server databases on single server hosts.
    Does anyone know how to connect to databases on windows clusters?
    Edited by: Ingmar on Jan 16, 2012 4:08 PM
    Edited by: Ingmar on Jan 16, 2012 4:22 PM

    Hi Ingmar,
    Try this is in the port box
    1433/dbname;instance=YYY
    dbname can be omitted
    -Turloch
    SQL Developer team
    1/Giving an instance name in SQLDeveloper connection to SQL Server (from August 2011)
    MS SQL Server Connection
    The correct syntax to deal with this is in the port box
    1433/dbname;instance=instance
    dbname can be omitted
    2/cluster configuration (uses instance name)
    http://stackoverflow.com/questions/1160024/jdbc-connect-string-for-sql-server-cluster
    where vvv\iii is the cluster address: jdbc address is:
    "jdbc:sqlserver://vvv;instanceName=iii"
    3/jtds url details available in
    http://jtds.sourceforge.net/faq.html

Maybe you are looking for