简体   繁体   中英

In FitNesse is it possible to share variables or data between Java and FitSharp test pages?

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM