Aug 13 2008

Please help test DbFit 1.1

Published by gojko at 12:06 pm under dbfit,news

I have merged DbFit with fitnessedotnet release 1.7.1 and fitnesse (java) release 20080812. I will publish a new official release (1.1) in a few days.

My acceptance tests are running OK. If you are using DbFit at the moment, please take 10 minutes to test the latest beta version and let me know if you encounter any problems, so that I can fix any potential issues before the release. Download the betas from:

dbfit-20080813.jar (java)

dbfit-dotnet-20080813.zip (dotnet)


Get notified when I post something new - subscribe via RSS or Twitter!

27 responses so far

27 Responses to “Please help test DbFit 1.1”

  1. Bryanton 14 Aug 2008 at 10:38 pm

    Hi Gojko,

    I have been using DbFit for about 2 weeks. It has been really helpful! Great job! What are the new features for 1.1? And how do I write a test expecting no results, but without using a ‘Count’ because I want useful failing data. For example:

    Preferred:
    !|Ordered Query|!-
    SELECT CarName, MPGCity, MGGHwy
    FROM CarDealership
    WHERE
    MPGCity < 15
    -!|
    |CarName|MPGCity?|MPGHwy?|
    ||||

    Not Preferred:
    !|Ordered Query|!-
    SELECT COUNT(*) AS ExpectedCount
    FROM CarDealership
    WHERE
    MPGCity < 15
    -!|
    |ExpectedCount|
    |0|

    Thanks,

    Bryant

  2. gojkoon 14 Aug 2008 at 11:47 pm

    Bryant,

    Just don’t list any data after the header (specify the result set format, though). So

    !|Ordered Query|!-
    SELECT CarName, MPGCity, MGGHwy
    FROM CarDealership
    WHERE
    MPGCity < 15
    -!|
    |CarName|MPGCity?|MPGHwy?|

    regarding new features, see the list on top ofchangelog, before the marker of 1.0 release.

  3. Bradon 15 Aug 2008 at 1:10 pm

    Gojko,

    Well, got past the first Set Parameter error where it couldn’t cast it to a fixture, but now it doesn’t appear to be setting the value of the parameter.

    My set looks like this:

    |Set Parameter|environment|UTest|

    But when I go to use “<>environmentcodesetid|

    !|Insert|code|
    |codesetid|codevalue|codedsc|displaysq|isactive|isdefault|codeid?|
    |<<environmentcodesetid|<>utestcodeid|

    the “environment” value shows as null (though the environmentcodesetid value is correct), and my insert fails because the table won’t accept nulls in the column. Did the behavior of SetParameter change with this release, or am I doing something else wrong.

  4. Bradon 15 Aug 2008 at 1:13 pm

    I should add that using

    !|dbfit.SqlServer2000Test|
    |Connect|etc|

    The SetParameter fixture works, properly setting the value.

  5. gojkoon 15 Aug 2008 at 1:24 pm

    Brad,

    the symbols (parameters) only work on full cell content, not on substrings. if you set the “environment” parameter, you have to read it as <

  6. Bradon 15 Aug 2008 at 1:27 pm

    And for the record, I extracted the DbFit archive to the fitnesse\dotnet2 and set my TEST_RUNNER to “dotnet2\FitServer.exe”, because I noticed the dotnet directory was already populated with stuff that was dated later than the ones in your archive. I assumed that you intended your version of FitServer and fit.dll to be used with DbFit.

    If I was supposed to put dbfit.* into the dotnet directory instead, I tried that and got an exception saying “Import” couldn’t be found in assemblies.

  7. gojkoon 15 Aug 2008 at 1:30 pm

    dotnet folder earlier contained the version of fit.net test runner that works with .NET 1.1. FitNesse.NET runner 1.7.1 is included in the latest dbfit beta release. You can install that separately if you want, it will not make any difference. You will have to change the !path variable if you change the dll location.

  8. Bradon 15 Aug 2008 at 3:53 pm

    Hmmm, the wiki didn’t render my tables the same way I see them here, so I’ll try to repost what I have so that it looks right. I’ve added spaces between the greater than and less than symbols, as well as around the pipe symbols on the last row of the table. I hope that works. If not, I will post on the fitnesse list, if that’s OK.

    The set looks like this:

    |Set Parameter|environment|UTest|

    The insert looks like this:

    !|Insert|code|
    |codesetid|codevalue|codedsc|displaysq|isactive|isdefault|codeid?|
    | < < environmentcodesetid | < > utestcodeid |

    This construct works using the previous version of DbFit, and in fact works in the beta version if I’m in Flow mode, where environment contains “UTest”. It does not work, however, work in Standalone mode. In Standalone mode, environment is null.

  9. oliveron 15 Aug 2008 at 4:03 pm

    based on the documentation it seems that sqlserver is not supported for Java. Is this correct?
    >> from dbfit.pdf
    Support for Oracle (Java and .NET versions), MySql 5 (Java) and SQLServer
    2000 and 2005 (.NET version).

  10. gojkoon 15 Aug 2008 at 5:43 pm

    Brad,

    can you send me the table by e-mail. See my contact info here.

  11. gojkoon 15 Aug 2008 at 5:44 pm

    Oliver,

    the docs are not updated yet, I am doing it now. Sql Server is supported in the beta version of dbfit-java 1.1. Not all data types are supported yet, but the basic support is there.

  12. oliveron 20 Aug 2008 at 6:47 pm

    Brad,
    I’m trying the following

    !|Import|
    |dbfit.fixture|

    !|DatabaseEnvironment|SQLSERVER|
    |Connect|jdbc:inetdae7a://….|

    and I’m getting the following error with dbfit-20080813.jar any ideas why this connection is not working

    java.lang.Error: Cannot register SQL driver com.microsoft.sqlserver.jdbc.SQLServerDriver
    at dbfit.environment.AbstractDbEnvironment.registerDriver(AbstractDbEnvironment.java:36)
    at dbfit.environment.AbstractDbEnvironment.connect(AbstractDbEnvironment.java:41)
    at dbfit.fixture.DatabaseEnvironment.connect(DatabaseEnvironment.java:45)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at fitlibrary.closure.MethodClosure.invoke(MethodClosure.java:98)
    at fitlibrary.closure.MethodTarget.invoke(MethodTarget.java:71)
    at fitlibrary.closure.MethodTarget.invoke(MethodTarget.java:88)
    at fitlibrary.closure.MethodTarget.invokeAndWrap(MethodTarget.java:234)
    at fitlibrary.DoFixture.interpretCells(DoFixture.java:247)
    at fitlibrary.DoFixture.interpretRow(DoFixture.java:236)
    at fitlibrary.FlowFixture.runRow(FlowFixture.java:120)
    at fitlibrary.FlowFixture.doTable(FlowFixture.java:99)
    at fitlibrary.FlowFixture.doTable(FlowFixture.java:92)
    at dbfit.fixture.DatabaseEnvironment.doTable(DatabaseEnvironment.java:35)
    at fitlibrary.FlowFixture.interpretTableWithFixture(FlowFixture.java:89)
    at fitlibrary.FlowFixture.interpretTable(FlowFixture.java:62)
    at fitlibrary.FlowFixture.interpretTables(FlowFixture.java:46)
    at fitlibrary.FlowFixture.interpretTables(FlowFixture.java:27)
    at fit.Fixture.doTables(Fixture.java:73)
    at fit.FitServer.process(FitServer.java:74)
    at fit.FitServer.run(FitServer.java:50)
    at fit.FitServer.main(FitServer.java:41)

  13. gojkoon 20 Aug 2008 at 7:21 pm

    You need to download Microsoft SQL Server JDBC driver from their site, it is not opensource and I cannot distribute it with DbFit. Deploy the JAR in the same folder as dbfit-XXX.jar and use Microsoft’s driver in your jdbc connection string.

  14. oliveron 21 Aug 2008 at 2:54 pm

    Previous version just to work with current drivers like Merlia just using the appropriate connection string. Was this functionality removed?

  15. gojkoon 21 Aug 2008 at 2:57 pm

    previous version did not support sql server with java. were you using the official release of dbfit or something that you internally modified?

  16. oliveron 21 Aug 2008 at 11:11 pm

    So this will work but it will be auto rollback per page

    !|dbfit.SqlServerTest|
    |Connect|jdbc:inetdae7a://conntectionstring|

    insert

    call code under test

    query

    |Close|

    however I need to do inserts do commits then go to code under test and i believe the other connection type is the one that will allow me this freedom right?

  17. gojkoon 22 Aug 2008 at 3:15 pm

    Hi Oliver,

    to use the inetdae7a driver, I need to change the sql server integration for you. can you use the normal microsoft sql jdbc driver for testing?

  18. oliveron 22 Aug 2008 at 10:28 pm

    I see in the code source that DatabaseEnvironment does not implement close. Can this be added. If i have several builds running there are transactions left open until the whole suite completes. I would to have on my TearDown the
    |DatabaseEnvironment|
    |close|
    I see it is implemented on the SqlServerTest. are there any plans to add this implementation.
    thanks
    O

  19. gojkoon 24 Aug 2008 at 11:20 am

    I’ll add that in the next few days

  20. gojkoon 25 Aug 2008 at 2:08 pm

    Hi Oliver,

    the close method is now implemented in the database environment fixture. get the new version from here

  21. Andyon 18 Feb 2009 at 10:46 pm

    If I want to use a different jdbc driver (e.g. jtds for SQLServer access) how do I go about that? I see where I specify the connection URI but that is not enough since I also need to specify the driver
    e.g.
    net.sourceforge.jtds.jdbc.Driver
    jdbc:jtds:sqlserver://amsxp/fund_master;instance=DEVLOCAL

  22. gojkoon 19 Feb 2009 at 7:50 am

    You’ll have to implement your own DbEnvironment instance (and plug it into a DbTest instance). In your case, that might be as simple as just extending SqlServerEnvironment and changing the driver name and url.

  23. gojkoon 06 Jul 2010 at 5:09 pm

    It should work with 2008. I haven’t tried it but sql server is generally good with backward compatibility

  24. gojkoon 06 Jul 2010 at 5:11 pm

    Chan,
    Google for integrated security connection strings and use the variant of connect that specifies the full connection string

  25. Chan Nguyenon 06 Jul 2010 at 6:07 pm

    Hi gojko !
    I’m a newbie to Database, so I currently struggled a bit with how to make DbFit works with SQL Server 2008. I tried some examples in your Test Driven Database Development With DbFit book, but I got a punch of errors :( .
    I’m using SQL Server 2008 Developer Edition and DbFit 1.1 under Windows 7 OS.

    I followed the instruction from this website to install SQL Server 2008 :
    : http://msdn.microsoft.com/en-us/library/dd299415(SQL.100).aspx
    Since I did not set the username and password for log in to Windows, I’m a bit confused how to put username and password field for DbFit’s commands.
    I tried :

    !define COMMAND_PATTERN {%m %p}
    !define TEST_RUNNER {dotnet3\FitServer.exe}
    !define PATH_SEPARATOR {;}
    !path dotnet2\*.dll

    !|dbfit.SQLServerTest|

    !|Connect|localhost|||

    I used dotnet2 for C# and dotnet3 for SQL Server. My current login user name is Chan-PC/Chan and I have no password.

    I created a page with -p 8888 and run it as test, I got these errors :

    System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> System.Data.SqlClient.SqlException: Login failed for user ”.
    at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
    at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
    at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
    at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)
    at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject)
    at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)
    at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
    at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
    at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
    at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
    at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
    at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
    at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
    at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
    at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
    at System.Data.SqlClient.SqlConnection.Open()
    at dbfit.AbstractDbEnvironment.Connect(String connectionString) in D:\work\dbfit\impl\dotnet\src\environment\AbstractDbEnvironment.cs:line 66
    at dbfit.DatabaseTest.Connect(String dataSource, String username, String password) in D:\work\dbfit\impl\dotnet\src\DatabaseTest.cs:line 29
    — End of inner exception stack trace —
    at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
    at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
    at fitlibrary.Method.Invoke(Object[] theParameters)
    at fitlibrary.Method.Invoke(Fixture theFixture, IEnumerable theCells)
    at fitlibrary.FlowFixtureBase.ExecuteMethod(Method theMethod, CellRange theCells)
    at fitlibrary.FlowFixtureBase.ProcessFlowRow(Parse theCurrentRow)

    Could you give me some hints where I did wrong and one simple example so I can understand it better? Thanks a lot in advance.

  26. Chan Nguyenon 06 Jul 2010 at 6:07 pm

    Does DbFit work with SQL Server 2008?

  27. Chan Nguyenon 07 Jul 2010 at 8:18 pm

    Hi gojko,
    Thanks for your reply, I got it working by this method:
    !|Connect|Data Source=HXG2MJ1\SQLEXPRESS;Initial Catalog=MyDatabase;Password=12345678;Integrated Security=SSPI;|

    One guy in SQL Server Forum showed me this one. I just want to ask you that how could I find the document for those commands above?
    Another strange things that I came across is that:
    - When I create a single page ( let’s say http://localhost:8085/OneExample )
    - Content:

    —————————————————————————————-
    !define COMMAND_PATTERN {%m %p}
    !define TEST_RUNNER {dotnet2\FitServer.exe}
    !define PATH_SEPARATOR {;}
    !path dotnet2\*.dll

    !|dbfit.SqlServerTest|

    !|Connect|Data Source=HXG2MJ1\SQLEXPRESS;Initial Catalog=MyDatabase;Password=12345678;Integrated Security=SSPI;|

    !|Query| select ‘test’ as x|
    |x|
    |test|
    —————————————————————————————-

    It worked fine, but when I create a Suite page w/ SetUp page content:

    —————————————————————————————-
    !define COMMAND_PATTERN {%m %p}
    !define TEST_RUNNER {dotnet2\FitServer.exe}
    !define PATH_SEPARATOR {;}
    !path dotnet2\*.dll

    !|dbfit.SqlServerTest|

    !|Connect|Data Source=HXG2MJ1\SQLEXPRESS;Initial Catalog=MyDatabase;Password=12345678;Integrated Security=SSPI;|
    —————————————————————————————-

    And then a sub-page w/ content:

    —————————————————————————————-
    !|Query| select ‘test’ as x|
    |x|
    |test|
    —————————————————————————————-

    Dbfit complained :(

    —————————————————————————————-
    System.ApplicationException: Type ‘dbfit.SqlServerTest’ could not be found in assemblies.
    Assemblies searched: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
    file:///C:/dbfit/dotnet2/FitServer.exe
    file:///C:/dbfit/dotnet2/fit.DLL
    file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
    file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
    file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
    file:///C:/WINDOWS/assembly/GAC_32/System.Web/2.0.0.0__b03f5f7f11d50a3a/System.Web.dll
    Load errors: Could not load file or assembly ‘file:///C:\dbfit\defaultPath’ or one of its dependencies. The system cannot find the file specified.
    at fit.Assemblies.FindType(TypeName theName)
    at fit.TypeName.get_Type()
    at fit.TypeName.CreateInstance()
    at fit.Fixture.LoadClass(String theClassName)
    at fit.StoryTest.DoTables()
    —————————————————————————————-

    This is so weird ! I tried to check for spelling many times so I think it must be something wrong w/ the linker? Can you help me ?
    Thanks,

Trackback URI | Comments RSS

Leave a Reply