Cannot get StatLight to run my tests :(

Oct 13, 2011 at 10:25 PM

I tryied a little while ago with no luck but now I really need to get this working.

Here's my scenario. I have a big (?) solution which contains, of course, server-side and client-side (Silverlight) projects.

In my Server side I have a library which manages the DB access with Entity framework, plus some RIA Services to expose the CRUD operations to the client.

On the client-side I have a library with ViewModels and the RIA Services Context, plus a project with the Views (the UI itself).

So I created a Silverlight Unit Test Framework project which referencing my ViewModels I can test their functionality against the server. So far, so good, right?

The thing is I don't want to have my tests hit the database so I created a FakeContext which is created because of a Conditional Compilation Symbol (TEST) I have in my tests solution. So yes, I have two solutions with the exact same projects, except for the ones that need to access the DB, those were replaced by copies of the original csproj file with the added TEST compilation symbol.

Everything works just fine when I execute the SUTF app and run my tests. The problem is that I need to run StatLight and I can't figure out what's going on :S

So far all I see is this warning message:

An unknown request was made to the StatLight's web server. You may want to check your test project for what generated the following request.
********** Request Information **********
       Url : http://localhost:8887/CCARS-Server-Services-CCARSService.svc/binary/GetProjectInPOPreparationExecution?id=1
HttpMethod : GET
  PostData :

Can somebody please help me out?

Oct 14, 2011 at 12:11 AM

Something somewhere in a test or your production code something is trying to talk back to "home-base" meaning it hasn't been configured to talk to a separate service somewhere.

You need to track down what is making this call, and re-configure it to talk to something like "http://localhost/(SomeOtherServiceProbablyHostedInIIS or on a different port by something else like cassini or iis express).

Hope this helps.

Oct 14, 2011 at 1:36 PM

mmm... well, my tests are asynchronous so I invoke the server and then wait for the callback... but I don't see how that can affect the tests since silverlight is supposed to work like that :S

Is there a way I can debug that? I wrote an Assert in order to attach to the process but StatLight closed it for me...

thanks for your help Jason, I believe you have a great product here!

Oct 14, 2011 at 2:15 PM

I think I know where the problem comes from... my RIA Services Context is located on a single library (not the actual SL UI app) and it is the responsible for calling my services at http://localhost/MIISwebApp... but the xap where that library is running it is on Statlight's web server (http://localhost:8887) and thus it is not solving the actual server url right, right?

I'll try dig into that, and try to reach the RIA services guys.

I'll keep you posted, thanks again

Oct 14, 2011 at 3:48 PM

just FYI, here it'll be the answer to my problem

As I mentioned before, the DomainClient is "creating" an invalid ServiceUri, If write the uri myself statlight works like a charm :)

best regards

Oct 14, 2011 at 3:57 PM

Perfect! Glad you go it working.