Re: Database testing with automated verifications of your modifications ?



How do you want to record the expected changes?
Using some kind of capture/playback tool?
Or some specify the changes in some xml file?

Well, I was trying to illustrate the way I would prefer to define the
expected changes, but some XML file could be okay too.

... Just go head and write that class. That should not take much time...

Well, I think it would be easy to implement regarding just counting the
difference in number of rows (inserts/updates) for a table, but it is
more complicated with updates when you want to specify the type of
changes (for example, if you want to check that a certain integer
column value has increased with a certain amount or percentage).
Also, insert/deletes can be more complicated if you want to be able to
define exactly which rows that have been deleted (i.e. maybe with
support for compound primary keys of different data types for
specifiying the chaged rows)

I think I might fairly simple create something that covers my current
needs, but if you want something very flexible that can be reused for
many more different needs in different applications, I think it will
become more complicated, and I was looking for an existing framework,
but maybe it does not exist.

/ Tom





Shrinik wrote:
Interesting ...

How do you want to record the expected changes?

Using some kind of capture/playback tool?

Or some specify the changes in some xml file?

you pretty much done the work by specifying the pseudo code... Just go
head and write that class. That should not take much time. All you need
to do is execute some select queries and verify that changes are done
at the db as expected

You might want to add following in the begining of the code

oDatabaseTester.TakeSnapShot()

Shrini

tomjbr.32022025@xxxxxxxxxxxxx wrote:
Can anyone recommend a good framework (preferably open source) for .NET
that can be used for database testing ?

The thing I want to be able to do is the following:
(1) Define the expected database changes that I want my following code
to trigger
(2) Take a snapshow of the database before my test code starts
(3) Execute my code being tested
(4) Verify that all the changes have been done to the database

In other words, I am looking for a component that can be used in a
similar way as some mock object frameworks where you record the
expected methods that should be invoked by your code, but instead I
want to record the expected database changes that will be triggered by
my code.

To further explain what I mean, here is a code sample of the kind of
feature I would wish:

string connectionString = "...";
DatabaseTester oDatabaseTester = new DatabaseTester(connectionString);
oDatabaseTester.AddExpectation(new RowsInserted("tableName1", 3)); // 3
rows is expected to become inserted to table "tableName1"
oDatabaseTester.AddExpectation(new RowsDeleted("tableName2", 4));// 4
rows is expected to become deleted from table "tableName2"
oDatabaseTester.AddExpectation(new UpdatedRow("tableName3",
"columnName1", "newValue", "123"));
// the value of the column "columnName1" will get the value "newValue"
at the row with the primarykey "123" in the table "tableName3"
oDatabaseTester.MakeSnapShotOfTheDatabase(); // the content of the
database will be stored internally in the DatabaseTester class

// the code that should cause the above changes to the database (for
example NHibernate code or whatever)

oDatabaseTester.VerifyAllExpectationsHaveBeenMetSinceTheSnapshot();

/Tom

.



Relevant Pages

  • Re: Import Text with existing schema.ini file utility
    ... the database engine looks for schema.ini. ... As far as I know it's not possible to specify schema.ini in SQL; ... DAO is specifically designed to work with the Jet ... >> oDB.Execute strSQL ...
    (microsoft.public.access.modulesdaovba)
  • Re: KirbyBase
    ... creating objects from the database records was much easier. ... Hal, I don't know if you have had a chance to take a look at the beta yet, but I basically tried to implement a uniform way to specify one-to-one links, one-to-many links, and calculated fields in the ... I suppose it would in effect be embedding an array where all the ... My first couple of attempts at adding more complexity to KirbyBase did not honor this concept. ...
    (comp.lang.ruby)
  • Re: Database testing with automated verifications of your modifications ?
    ... Using some kind of capture/playback tool? ... Or some specify the changes in some xml file? ... but some XML file could be okay too. ... .NET that can be used for database testing? ...
    (comp.software.testing)
  • Re: Access 2002 command line options.
    ... > database Opens the specified database. ... > /excl Opens the specified database for exclusive access. ... > /user user name Starts Microsoft Access using the specified user name. ... To compact to a different name, specify a target ...
    (microsoft.public.access.developers.toolkitode)
  • Re: Access 2002 command line options.
    ... The following table lists the Microsoft Access command-line options. ... database Opens the specified database. ... To compact to a different name, specify a target ... returned by the Command function. ...
    (microsoft.public.access.developers.toolkitode)