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,611
|
Comments: 51,243
Privacy Policy · Terms
filter by tags archive

Testing UI

time to read 2 min | 241 words

I've a question regarding testing GUI applications, spesifcally, it's related to NHibernate Query Analyzer.

I started this application as a spike (I think that is the XP term) / proto-type, so I didn't bother writing tests or following any TDD rules. Currently, the only tests that were done to the product were manual ones, with me running the application and writing down the results.

Now, NHibernate Query Analyzer is no longer a prototype, and I'm a bit uncomfortable using it without tests. It's compromised from several core/utitilies classes, with all the rest being UI. Writing the tests for the core wouldn't be a problem, but how do I test the UI?

I'm aware of NUnit.Forms but I wonder how far should I take it? When do I stop doing Unit Testing and move to integration testings? When I make a change in the UI, and save it, do I need to verify that it was saved correctly, or to trust the core tests to catch that? What about missing links in the core<->UI connections (so I forget to save a field), how do I catch that? In the UI layer (save and then load, then test it all?) or do I go directly to the core classes?

Any ideas would be welcomed,

Thanks in advance,

time to read 1 min | 195 words

I've been using ReSharper for a long time, and I don't think that there is anyone who read my blog who doesn't know how highly I think of it.

Nevertheless, today I was taken about by it's capabilities.

I'd a class B that inherit from class A, where A has a non trivial constructor, and class B is a small extention to A. I wrote the class and the single extra member, and told ReSharper to generate a constructor. It generated a constructor that include both the new member and all the requirements for class A's constructor, and even add a call to it.

That would've been the way I would've written it. And it saved me some small but measurable amount of time (which I'm using to write this post).

Joel's post about debugged products come to my mind when I saw this. That is one quality product! The attention to details is simply amazing. And I haven't even began to use all the new features in the Early Access Program for version 1.5.

time to read 1 min | 123 words

I spent the weekend adding a Cfg.Xml editor to NQA, it should've been a few minutes of coding, but expanded to ~1,500 lines just to get it right.

I'm pretty sure that it now works currectly, but there are some issues with saving invalid files (syntaticly correct, but that fail to configure), that I will need to investigate further.

The remaining big feature that I want to add is a Hbm.Xml editor, which should prove quite a challange.

After that, I'll move the project to beta and start pushing to 1.0 release.

The current code is in repository,  svn checkout svn://svn.berlios.de/nqa

time to read 2 min | 218 words

I've previous mentioned MyGeneration and not in favorable terms, the application took a very long time to start and used over 0.5 Gb (!) of RAM.

Since them, Mike Griffin have contacted me and sent me a fix that solved the problem in a very complete way. (Right now the startup time is ~5 seconds and modest memory size).

Naturally, I'm unique, and in over 42,135 people who downloaded the product, I'm one of the two that have this problem. I can't say that I'm excited about this.

What I'm excited about it that the fix not only fixed the current version, but the previous versions as well. I intended to use the new JetBrain profiler to check what was the cause for the problem. Unfortantely I'm unable to repreduce it. I unistalled the fixed and wiped out any trace of it in the system, and then install the version with the problem. Behold, it's fixed!

Niether Mike nor I can understand what happens to cause this (the problem or the magic solution).

Oh well, at least now I can get to use the product. It seems to have interesting capabilities and (most importantly) it has NHibernate templates :-)

time to read 5 min | 923 words

I found this nice utility at PerfectXml, it allows you to run ad-hoc XPath queries against any xml document and report both the results and the type of the result.

The only addition that I've made was to add namespace support, you can use it this way:
xpather hibernate.cfg.xml //nh:session-factory/ nh=urn:nhibernate-configuration-2.0

I've found it very useful for small testing of xpath expressions, mainly because I uses XPath every once in a while, so I tend to forget the particulars.

using System;
using System.Xml;
using System.Xml.XPath;
class Class1
{
   [STAThread]
   static void Main(string[] args)
   {
      if(args.Length < 2)
      {
         Console.WriteLine("Incorrect number of parameters.");
   Console.WriteLine("Usage: xpather <filename> <xpath> <ns-prefix=namespace> <ns-prefix=namespace>...");
         return;
      }
      try
      {
         //Load the XML document

         XmlDocument doc = new XmlDocument();
         doc.Load(args[0]);
         //Create XPathNavigator

         XPathNavigator xpathNav = doc.CreateNavigator();
  XmlNamespaceManager nsMgr = new XmlNamespaceManager(xpathNav.NameTable);
   
   for(int i=2;i<args.Length;i++)
   {
   string[] tmp= args[i].Split('=');
   if(tmp.Length==2)
   {
    nsMgr.AddNamespace(tmp[0],tmp[1]);
   }
   }
   
         //Compile the XPath expression

         XPathExpression xpathExpr = xpathNav.Compile(args[1]);
   xpathExpr.SetContext(nsMgr);
         //Display the results depending on type of result

         switch(xpathExpr.ReturnType)
         {
            case XPathResultType.Boolean:
               Console.WriteLine("Boolean value: {0}"
                  xpathNav.Evaluate(xpathExpr));
               break;
            case XPathResultType.String:
               Console.WriteLine("String value: {0}"
                  xpathNav.Evaluate(xpathExpr));
               break;
            case XPathResultType.Number:
               Console.WriteLine("Number value: {0}"
                  xpathNav.Evaluate(xpathExpr));
               break;
            case XPathResultType.NodeSet:
               XPathNodeIterator nodeIter =  xpathNav.Select(xpathExpr);
               Console.WriteLine("Node-set count: {0}"
                  nodeIter.Count);
               while(nodeIter.MoveNext())
                  Console.WriteLine(nodeIter.Current.Value);
               break;
            case XPathResultType.Error:
               Console.WriteLine("XPath expression {0} is invalid."
                  args[1]);
               break;
         }
      }
      catch(Exception exp)
      {
         Console.WriteLine("Error: " + exp.ToString());
      }
  }
}

 

time to read 1 min | 110 words

I read a bit about IoC, and while I think that it's a useful pattern, I've not used it in my applications. Mainly for lack of need and reluctance to complex my life even further :-). Not to mention that I dislike learning another XML Dialect.

After reading this article, it seems that IoC can be much better than the current popular implementations.

The gist of the article is using an interface that encapsulate all the external needs for the class, which allows for greater flexibility and testability. I'll probably use it on the next application that I'll create.

time to read 1 min | 155 words

I seems to have misplaced my weekend, since it just vanished without a trace. All I did was catch up on my reading and then handle some personal matters and then it whisked away.

I got a note that I might meet it in a few days, but only if I behave. Do you think that I need to post a carton milk shot to find it?

On other news, I found Product image for ASIN: 0786818603 The Golem's Eye in a book store yesterday, I very much enjoyed the  Product image for ASIN: 078681859X The Amulet of Samarkand, so I look forward to read it. 

time to read 1 min | 134 words

No, I'm not going to complain about something here.

I returned from a trip the the lowest place on the world, 408 meters below the sea level. The Dead Sea.

The view was fantastic, and convinced me that I really do need a digital camera :-)

Hebrew speakers will cring at the translation, but this is what passed through my head there:

Israel is beautiful and flowering,
Who built and who planted?
All of us together!

FUTURE POSTS

No future posts left, oh my!

RECENT SERIES

  1. Recording (18):
    29 Sep 2025 - How To Run AI Agents Natively In Your Database
  2. Webinar (8):
    16 Sep 2025 - Building AI Agents in RavenDB
  3. RavenDB 7.1 (7):
    11 Jul 2025 - The Gen AI release
  4. Production postmorterm (2):
    11 Jun 2025 - The rookie server's untimely promotion
  5. RavenDB News (2):
    02 May 2025 - May 2025
View all series

Syndication

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