Oren Eini

CEO of RavenDB

a NoSQL Open Source Document Database

Get in touch with me:

oren@ravendb.net +972 52-548-6969

Posts: 7,590
|
Comments: 51,218
Privacy Policy · Terms
filter by tags archive
time to read 6 min | 1123 words

I posted before that adding the ability to copy files after a build was not as straight forward as it should, mainly because VS.Net decides to take active part in this and resolve the paths manually.

Here is how I ended up solving the issue:

<Target Name="AfterBuild">

        <CreateItem Include="$(MSBuildProjectDirectory)\..\Configuration\**\*.config">

              <Output TaskParameter="Include"

                          ItemName="ConfigurationFiles" />

        </CreateItem>

        <RemoveDir Directories="$(MSBuildProjectDirectory)\bin\$(Configuration)\Configuration" />

        <MakeDir Directories="$(MSBuildProjectDirectory)\bin\$(Configuration)\Configuration" />

        <Copy SourceFiles="@(ConfigurationFiles)"

                  DestinationFolder="$(MSBuildProjectDirectory)\bin\$(Configuration)\Configuration\%(RecursiveDir)" />

  </Target>

This force runtime evaluation, and thus saving it from VS.Net clutches. I got the script from Doug, who uses it to copy files that are created on the fly.

time to read 5 min | 872 words

Here is a very easy way to find out if your database schema is still the same one that NHibernate expects:

[Test]

public void AllNHibernateMappingAreOkay()

{

   ISessionManager sessionManager = IoC.Resolve<ISessionManager>();

   using (ISession session = sessionManager.OpenSession())

   {

       IDictionary allClassMetadata = session.SessionFactory.GetAllClassMetadata();

       foreach (DictionaryEntry entry in allClassMetadata)

       {

           session.CreateCriteria((Type) entry.Key)

                .SetMaxResults(0).List();

       }

   }

}

This issues selects on all the mapped classes, so it will fail if the database is not in the expected sharep.

As a test, it is pretty rough, but it can find the missing column / table issues very quickly.

time to read 4 min | 767 words

I've started looking at writing integration tests for an ASP.Net application. I have a farily complex application with quite a bit happening in the UI layer. Some pages are fairly simple data entry forms, and some contains UI that is scary to just think about (the amount of work it would take). It has long been my belief that it is not worth testing the UI layer. A lot of effort goes into this, and it is usually fragile in the face of changes.

The problem is that without tests is it very easy to break stuff, and I get lost in the amount of pages / controls that I have there already. It took a failure (in the middle of a client demo, of course) to convince me that it is not enough to verify changes manually. I'm currently investigating WATIR, and it looks like it is farily simple to work with it once we learn ruby, the API and the quirks.

Current things that I have issues with are speed, state, enconding, controls naming, popups and alerts.

Speed seems to be an issue, so far I have only tested it in interactive mode, but it looks like it takes quite a bit of time to run. Quite a bit of time means that I can see things happening. Looking at the documentation, I noticed such things as -f (fast), so it may be a debug mode slowdown so I could keep track of what is going on.

State is the issue of what is the current state of the application for the test. For instance, I may want to try updating an entity, and this means that it have to exists, or creating an entity when it has a certain parents, etc. This require a lot more thought than just Unit Tests, since in Unit Tests I either mocks the whole infrastructure layer (and it is not fun, trust me), or I nuke the entire DB between tests. Testing it via ASP.Net is more complex, since I have to take into account such things as caching, etc. This make it a more real test case, but make it harder to write the test. Oh well, at least the secretary wouldn't do it.

Enconding may be a problem. This is still a heresay only, but I understand that ruby has issues with unicode. A lot of the texts that I need to verify in my pages is in Hebrew, so this may be a real problem. We haven't run into it yet, but we are just beginning.

Controls naming is an ugly beast in ASP.Net, you get names like this one "ShowArchive1$dgArchive$_ctl3$_ctl0", and they may change very easily. I really don't like to see them in the tests. I think that using indexes to find the controls is just as evil in any case.

Rant: Why on hell WATIR indexes are 1-based?

Popups and alerts seems to be a weak point in WATIR, I couldn't get it to work no matter what I did, and eventually I had to resort to this to get a simple confirm dialog to work. Just so you would understand, this opens a whole new process just to send an OK to the window. There doesn't seem to be any way to get the text of the cofirm/alert window. More worrying is the popup functionality, I can't find a way to handle a modal popup nicely. It looks like I would need two tests there, one to handle the code up to the popup and afterward, and another to handle the popup itself.

Some interesting links about WATIR:

time to read 1 min | 156 words

Microsoft and VMWare has made their base and medium level products free, but by doing this, the free OSes advantage became very clear. Take a look at this list of avialable VMWare images. Rails, Python, PostgresSQL, Trac,  and I am only counting the ones that interest me.

Thoughtworks' Buildix is a Linux/CruseControl/Subversion server, and it targets just the Java space, and it is a crying shame. I am currently working on duplicating that, but I will not be able to share my efforts, due to licensing restrictions.

Using VMs is a great way to just drop a pre-configured server into your organization, and have the It Just Works experiance. Now, Microsoft allows four (or is it two, can't recall at the moment) VM OSes per each real license that you already have. It would be wonderful if they would also allow distribution of those systems.

time to read 1 min | 161 words

I was at a client today, and I was looking for a guy, poking my head in rooms and asking for him. At some point a guy saw me coming, heard who I was asking for and run away. Now, I had not have that reaction in a while, so I was a bit puzzled about his behavior, I didn't even brought my trusty 5kg hammer with me.

Apperantly, this guy was called to reserve duty (we are at war at the moment), but he didn't bother to show up. When I showed up at his work asking for him (actually, another guy with the same name, he didn't stick around to figure it out) he figured out that I was military police coming to arrest him for not showing up.

The funny part (on my part, at least), was that I am military police (or was, now in reserve duty).

FUTURE POSTS

  1. RavenDB & Distributed Debugging - 2 days from now
  2. RavenDB & Ansible - 5 days from now

There are posts all the way to Jul 21, 2025

RECENT SERIES

  1. RavenDB 7.1 (7):
    11 Jul 2025 - The Gen AI release
  2. Production postmorterm (2):
    11 Jun 2025 - The rookie server's untimely promotion
  3. Webinar (7):
    05 Jun 2025 - Think inside the database
  4. Recording (16):
    29 May 2025 - RavenDB's Upcoming Optimizations Deep Dive
  5. RavenDB News (2):
    02 May 2025 - May 2025
View all series

Syndication

Main feed ... ...
Comments feed   ... ...
}