Can the solution to
replace the call to a InitScript(
sqlMap.DataSource, ScriptDirectory + "account-insert.sql" ); By InitScript(
sqlMap.DataSource, ScriptDirectory + "account-drop.sql" ); InitScript(
sqlMap.DataSource, ScriptDirectory + "account-create.sql" ); InitScript(
sqlMap.DataSource, ScriptDirectory + "account-insert.sql" ); Can be Ok ? De : roberto
[mailto:[EMAIL PROTECTED] For the Init() methods in
the tests, it is the various InitScript(
sqlMap.DataSource, ScriptDirectory + "account-init.sql" );
calls that need to be changed for Oracle. At this time,
account-init.sql, like the other similar –init.sql scripts, contains a
DROP table, CREATE table, and multiple INSERTs. The ScriptRunner is
taking that file’s text for the one command, but the two Oracle providers
(ODP and OracleClient) that I’m using don’t like multiple/mixed DDL
or DML/batch SQL statements in one command text unlike MSSQL. Therefore, I’ve split
the DROP and CREATE into their own files and wrapped the INSERTs in a PL/SQL
BEGIN END block to get the INSERTs to run in one command. The
InitSqlMap() is fine. Aside from the SqlMapTests,
I see that TransactionTest and the 5 DaoTests also call the –init.sql
scripts. To change the ScriptRunner
to get the basic account-init.sql script to run for Oracle would mean parsing
the file’s text to break it up into multiple commands to be executed
(probably looking for the “;” in Oracle’s case to get the
statements and removing any comments in the scripts). That’s the
main reason for me bringing up changing or separating out the Inits/SetUps for
the tests. Either method would work I
guess (ScriptRunner change vs Init change in the tests). Roberto -----Original
Message----- A you have seen, I think of testing for multiple database, in the
IBatisNet.Test.dll.config, you can find some keys to set the database testing <appSettings>
<!-- To test MySql set value="MySql" (to do)-->
<!-- To test Oracle set value="Oracle" (to
do)-->
<!-- To test MS Sql Server set value="MSSQL"
-->
<add key="database" value="MSSQL"/>
<!-- To test MS SqlServer via SqlClient value="SqlClient"
-->
<!-- To test MS SqlServer via OleDb value="OleDb" -->
<!-- To test MS SqlServer via Odbc value="Odbc" -->
<add key="providerType" value="SqlClient"/> </appSettings> As it is for now, you can test for one database/provider. In directory statementTest, you have a directory MSSQL but it only
test procedure or SQL specific to MSSQL that must be marked by Category(“MSSQL”)]as you noted (you can go it for that, +1). The directory IBatisNet.Test\Scripts already contains directory for
MSSQL, Oracle, MySQL. Oracle and MySQL directories are empty and ready to be
filled J You can create a package Oracle (+1) to test specific sql to Oracle
but the base test of SqlMapTests/*.cs must be passed by the couple
database/provider Oracle/OracleClient or Oracle/Oledb… For the Init() structure I don’t see what you want to change
as in general it call InitSqlMap() which already depend of the the couple
database/provider being tested and it is internal to a test file. You can go to reworking ScriptRunner with a switch case on
datasource if it can help you run an oracle DDL script. - De : roberto
[mailto:[EMAIL PROTECTED] Could we change
the Init() structure to accommodate running different SQL scripts depending on
the database being tested? I’ve
resorted to separating out the various Oracle statements into their own SQL
files and modifying the Init() methods of the current tests. I briefly
toyed with the idea of using EXECUTE IMMEDIATE and reworking the ScriptRunner
to use an Oracle package with ref cursors to run the DDL statements in one
script/command text but quickly got over it! Anyway, I think
the project may already have been headed in this direction given the MSSQL
tests in their own namespace. For example: Make
NUnit.SqlMapTests.StatementTest abstract. Create an
NUnit.SqlMapTests.Oracle namespace (like the existing MSSQL namespace).
And create an NUnit.SqlMapTests.Oracle.StatementTest with a different Init(). Additionally, we
can tag the specific db tests by NUnit Category such as
[Category(“MSSQL”)], [Category(“MySQL”)], and
[Category(“Oracle”)] or use some other convention. Roberto -- -- -- -- |
- Update NUnit tests for different databases? roberto
- Re: Update NUnit tests for different databases? Ted Husted
- RE: Update NUnit tests for different databases? Gilles Bayon
- RE: Update NUnit tests for different databases? Gilles Bayon