0

I've got what I assume is a fairly common scenario: I want to test a web service via FitNesse while also being able to inject and read data from the database behind the web service. For example, I'd like to do the following:

1) Save a record directly to the database; then

2) Use the web service to update the record that was created; then

3) Check the database record to see it has been updated correctly.

The potential fly in the ointment is that the database is SQL Server and I'm developing against my (localdb) instance of SQL Server on my local machine. So I need FitNesse to be able to connect to (localdb).

As far as I can see RestFixture, for testing a web service, only runs in the Java version of FitNesse. However, the Java version of DbFit, for connecting to databases, can only use Microsoft's JDBC driver for connecting to SQL Server. According to this Stackoverflow question the MS JDBC driver does not support named pipes so cannot connect to (localdb). Therefore I would have to use the FitSharp (.NET) version of DbFit, which works fine with (localdb).

Now the problem is combining Java RestFixture with FitSharp DbFit. For example, if I create a new record in the database via DbFit I want to read back the identity value of the record I've just created and use that value to identify the record to update via the web service. So I would need to pass a variable or some information from the FitSharp DbFit test page to the Java RestFixture test page. Is this possible?

Community
  • 1
  • 1
Simon Elms
  • 17,832
  • 21
  • 87
  • 103
  • I see (in http://stackoverflow.com/questions/11345746/connecting-to-sql-server-localdb-using-jdbc) that jTDS does support JDBC connection to localdb. Is that's an option for you? – Fried Hoeben Dec 18 '16 at 14:45
  • @FriedHoeben: Unfortunately not. The Java version of DbFit only supports the Microsoft JDBC driver for SQL Server. – Simon Elms Dec 18 '16 at 14:58

1 Answers1

1

As far as I'm aware it is not. The REST API does not support create and read? That would allow the entire test via REST (no direct database access required, and no need to run on same server as database).

Fried Hoeben
  • 3,247
  • 16
  • 14
  • Unfortunately the web API doesn't support create and read for all tables in the database, only new ones developed over the last few months. Creating orders and bookings, which are needed for the testing, would have to be done via a desktop application if they can't be injected directly into the database. It might be possible to automate the process of creating orders via the desktop application via something like Auto-It but that seems very complicated compared to just injecting the data directly into the database. – Simon Elms Dec 18 '16 at 14:36