I get a NotFound 404 on my first test

Aug 6, 2011 at 5:37 PM
Edited Aug 6, 2011 at 5:38 PM

Hi all, my Silverlight Test app runs ok with my first test, but when I run StatLight I get a 404 when trying to access my services.

Just want to add that my services require Windows Authentication, maybe that has something to do with the error I'm getting.

Here's my debug aoutput. thanks


StatLight - Version 1.4.4147
Copyright (C) 2009 Jason Jarrett
All Rights Reserved.

DiskXapHostFileLoader cannot find file - C:\<hidden>\packages\StatLight.1.4.4147\tools\StatLight.Client.For.December2008.xap
DiskXapHostFileLoader cannot find file - C:\<hidden>\packages\StatLight.1.4.4147\tools\StatLight.Client.For.March2009.xap
****************** Input options as configured ******************
ContinuousIntegrationMode          : False
Dlls                               : IEnumerable<string>
                                     {
                                     }
ForceBrowserStart                  : False
IsRequestingDebug                  : True
MethodsToTest                      : IEnumerable<string>
                                     {
                                     }
MicrosoftTestingFrameworkVersion   :
NumberOfBrowserHosts               : 1
OutputForTeamCity                  : False
QueryString                        :
ShowHelp                           : False
ShowTestingBrowserHost             : False
StartWebServerOnly                 : False
TagFilters                         :
TFSGenericReport                   : False
UnitTestProviderType               : Undefined
UseRemoteTestPage                  : False
WebBrowserType                     : SelfHosted
XapPaths                           : IEnumerable<string>
                                     {
                                       'tests\SilverlightTests\Bin\Debug\SilverlightTests.xap'
                                     }
XmlReportOutputPath                :
*****************************************************************
RunnerType = OneTimeConsole
Starting configuration for: tests\SilverlightTests\Bin\Debug\SilverlightTests.xap
XapItems.FilesContainedWithinXap = AppManifest.xaml
XapItems.FilesContainedWithinXap = CCARS.Client.Data.dll
XapItems.FilesContainedWithinXap = CCARS.Client.WCF.Proxy.dll
XapItems.FilesContainedWithinXap = Microsoft.Silverlight.Testing.dll
XapItems.FilesContainedWithinXap = Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll
XapItems.FilesContainedWithinXap = Plusvalia.Silverlight.Helper.dll
XapItems.FilesContainedWithinXap = SilverlightTests.dll
XapItems.FilesContainedWithinXap = System.ComponentModel.DataAnnotations.dll
XapItems.FilesContainedWithinXap = System.ServiceModel.DomainServices.Client.dll
XapItems.FilesContainedWithinXap = System.ServiceModel.DomainServices.Client.Web.dll
XapItems.FilesContainedWithinXap = System.ServiceModel.Web.Extensions.dll
XapItems.FilesContainedWithinXap = System.Windows.Controls.dll
Incoming MSTest file's hash = 357A677957F309AE85C3E5AEEDA43A32BCA23AD3
Attempting to open port at http://localhost:8887/
testPageUrlWithQueryString = http://localhost:8887/GetHtmlTestPage?
IRunner typeof(OnetimeRunner)


Starting Test Run: 06-Aug-11 13:35:21

Listening on http://localhost:8887/
Loading XapHost file [MSTestApril2010]
Loading XapHost [C:\<hidden>\packages\StatLight.1.4.4147\tools\StatLight.Client.For.April2010.xap]
XapItems.FilesContainedWithinXap = AppManifest.xaml
XapItems.FilesContainedWithinXap = CCARS.Client.Data.dll
XapItems.FilesContainedWithinXap = CCARS.Client.WCF.Proxy.dll
XapItems.FilesContainedWithinXap = Microsoft.Silverlight.Testing.dll
XapItems.FilesContainedWithinXap = Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll
XapItems.FilesContainedWithinXap = Plusvalia.Silverlight.Helper.dll
XapItems.FilesContainedWithinXap = SilverlightTests.dll
XapItems.FilesContainedWithinXap = System.ComponentModel.DataAnnotations.dll
XapItems.FilesContainedWithinXap = System.ServiceModel.DomainServices.Client.dll
XapItems.FilesContainedWithinXap = System.ServiceModel.DomainServices.Client.Web.dll
XapItems.FilesContainedWithinXap = System.ServiceModel.Web.Extensions.dll
XapItems.FilesContainedWithinXap = System.Windows.Controls.dll
re-writing host xap with the following files
    -  already has file AppManifest.xaml
    add -  CCARS.Client.Data.dll
        updated AppManifest - CCARS.Client.Data
    add -  CCARS.Client.WCF.Proxy.dll
        updated AppManifest - CCARS.Client.WCF.Proxy
    -  already has file Microsoft.Silverlight.Testing.dll
    -  already has file Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll
    add -  Plusvalia.Silverlight.Helper.dll
        updated AppManifest - Plusvalia.Silverlight.Helper
    add -  SilverlightTests.dll
        updated AppManifest - SilverlightTests
    add -  System.ComponentModel.DataAnnotations.dll
        updated AppManifest - System.ComponentModel.DataAnnotations
    add -  System.ServiceModel.DomainServices.Client.dll
        updated AppManifest - System.ServiceModel.DomainServices.Client
    add -  System.ServiceModel.DomainServices.Client.Web.dll
        updated AppManifest - System.ServiceModel.DomainServices.Client.Web
    add -  System.ServiceModel.Web.Extensions.dll
        updated AppManifest - System.ServiceModel.Web.Extensions
    -  already has file System.Windows.Controls.dll

*****************************************
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/GetProject?id=1
HttpMethod : GET
  PostData :
*****************************************

Exception Message:
Microsoft.VisualStudio.TestTools.UnitTesting.AssertFailedException: Assert.Fail failed. Load operation failed for query 'GetProject'. The remote server returned an error: NotFound.
   at Microsoft.VisualStudio.TestTools.UnitTesting.Assert.HandleFail(String assertionName, String message, Object[] parameters)
   at Microsoft.VisualStudio.TestTools.UnitTesting.Assert.Fail(String message)
   at SilverlightTests.PageMainPO.<>c__DisplayClass3.<FailSaveAsDraft>b__0(Object a, ProjectLoadedEventArgs b)
   at CCARS.Client.Data.ViewModels.PO.PageMainPOViewModel.OnProjectsLoaded(Object loError)
   at CCARS.Client.Data.ViewModels.PO.PageMainPOViewModel.QueryCompleted(LoadOperation`1 lo)
   at System.ServiceModel.DomainServices.Client.DomainContext.<>c__DisplayClass13`1.<Load>b__11(LoadOperation lo)
   at System.ServiceModel.DomainServices.Client.LoadOperation.<>c__DisplayClass4`1.<Create>b__0(LoadOperation`1 arg)
   at System.ServiceModel.DomainServices.Client.LoadOperation`1.InvokeCompleteAction()
   at System.ServiceModel.DomainServices.Client.OperationBase.Complete(Exception error)
   at System.ServiceModel.DomainServices.Client.LoadOperation.Complete(Exception error)
   at System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult)
   at System.ServiceModel.DomainServices.Client.DomainContext.<>c__DisplayClass1b.<Load>b__17(Object )

------------------ Test Failed ------------------
Test Namespace: 
Test Class: 
Test Method:
Other Info: Microsoft.VisualStudio.TestTools.UnitTesting.AssertFailedException: Assert.Fail failed. Load operation failed for query 'GetProject'. The remote server returned an error: NotFound.
   at Microsoft.VisualStudio.TestTools.UnitTesting.Assert.HandleFail(String assertionName, String message, Object[] parameters)
   at Microsoft.VisualStudio.TestTools.UnitTesting.Assert.Fail(String message)
   at SilverlightTests.PageMainPO.<>c__DisplayClass3.<FailSaveAsDraft>b__0(Object a, ProjectLoadedEventArgs b)
   at CCARS.Client.Data.ViewModels.PO.PageMainPOViewModel.OnProjectsLoaded(Object loError)
   at CCARS.Client.Data.ViewModels.PO.PageMainPOViewModel.QueryCompleted(LoadOperation`1 lo)
   at System.ServiceModel.DomainServices.Client.DomainContext.<>c__DisplayClass13`1.<Load>b__11(LoadOperation lo)
   at System.ServiceModel.DomainServices.Client.LoadOperation.<>c__DisplayClass4`1.<Create>b__0(LoadOperation`1 arg)
   at System.ServiceModel.DomainServices.Client.LoadOperation`1.InvokeCompleteAction()
   at System.ServiceModel.DomainServices.Client.OperationBase.Complete(Exception error)
   at System.ServiceModel.DomainServices.Client.LoadOperation.Complete(Exception error)
   at System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult)
   at System.ServiceModel.DomainServices.Client.DomainContext.<>c__DisplayClass1b.<Load>b__17(Object )
-------------------------------------------------

------------------ Test Failed ------------------
Test Namespace:  SilverlightTests
Test Class:  PageMainPO
Test Method: FailSaveAsDraft
Other Info: Tests Draft missing validations
Exception Message:
Microsoft.VisualStudio.TestTools.UnitTesting.AssertFailedException: Assert.Fail failed. Load operation failed for query 'GetProject'. The remote server returned an error: NotFound.
   at Microsoft.VisualStudio.TestTools.UnitTesting.Assert.HandleFail(String assertionName, String message, Object[] parameters)
   at Microsoft.VisualStudio.TestTools.UnitTesting.Assert.Fail(String message)
   at SilverlightTests.PageMainPO.<>c__DisplayClass3.<FailSaveAsDraft>b__0(Object a, ProjectLoadedEventArgs b)
   at CCARS.Client.Data.ViewModels.PO.PageMainPOViewModel.OnProjectsLoaded(Object loError)
   at CCARS.Client.Data.ViewModels.PO.PageMainPOViewModel.QueryCompleted(LoadOperation`1 lo)
   at System.ServiceModel.DomainServices.Client.DomainContext.<>c__DisplayClass13`1.<Load>b__11(LoadOperation lo)
   at System.ServiceModel.DomainServices.Client.LoadOperation.<>c__DisplayClass4`1.<Create>b__0(LoadOperation`1 arg)
   at System.ServiceModel.DomainServices.Client.LoadOperation`1.InvokeCompleteAction()
   at System.ServiceModel.DomainServices.Client.OperationBase.Complete(Exception error)
   at System.ServiceModel.DomainServices.Client.LoadOperation.Complete(Exception error)
   at System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult)
   at System.ServiceModel.DomainServices.Client.DomainContext.<>c__DisplayClass1b.<Load>b__17(Object )
-------------------------------------------------

StatLightService.TestComplete() with 7 total messages posted - Currently have 7 registered
SignalTestCompleteClientEvent
  {
    TotalMessagesPostedCount: 7
                      Failed: True
           TotalFailureCount: 1
             TotalTestsCount: 1
                   OtherInfo:
           BrowserInstanceId: 0
            ClientEventOrder: 7
      ClientEventCreatedTime: 06-Aug-11 13:35:22
  }

Awaiting a total of 7 messages - currently have 7
publishing TestRunCompletedServerEvent
webBrowser.Stop()


--- Completed Test Run at: 06-Aug-11 13:35:22. Total Run Time: 00:00:01.3230757

Test run results: Total 2, Successful 0, Failed 2,

Edit: Using fiddler I see the 404

Coordinator
Aug 7, 2011 at 8:40 PM

Looks like you have something in your test attempting to talk to the StatLight web server. In the log you should notice this output.

*****************************************
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/GetProject?id=1
HttpMethod : GET
  PostData : 
*****************************************

You need to re-configure anything that would talk to "home base" to talk to the actual location you have your web services running.

Coordinator
Aug 7, 2011 at 8:40 PM

Looks like you have something in your test attempting to talk to the StatLight web server. In the log you should notice this output.

*****************************************
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/GetProject?id=1
HttpMethod : GET
  PostData : 
*****************************************

You need to re-configure anything that would talk to "home base" to talk to the actual location you have your web services running.

Aug 7, 2011 at 9:10 PM
Edited Aug 7, 2011 at 10:09 PM

I did notice that but I thought maybe StatLight would start it's own web server on a predefined port.

So, I need to run it againgst my own server, right? how do I do that? havn't found documentation about it :(

Thanks

Coordinator
Aug 8, 2011 at 5:04 PM

StatLight starts up it's own webserver starting from port 8887 (and increments the port until it finds an open one) for it's own use. Another thing to note is your test code/assemblies get "sucked" into the StatLight app's runtime. So it's running in the context of StatLight (so "Home base" is statlight's web server).

If you have a project that has a test (code) that needs to talk to another web server you need to make sure.

  1. You can re-configure any service calls to talk to an external web server
  2. Your external web server has a fairly wide open crossdomain.xml to allow your silverlight tests to access the "cross domain" services.

I have a simple example of this usage in the StatLight source code. You can checkout a usage where I use the querystring parameter in statlight to pass in configuration to a test.

The following project is the silverlight test project that leverages the querystring configuration.

https://github.com/staxmanade/StatLight/tree/master/src/StatLight.RemoteIntegration/StatLight.ExternalWebTest

The following is the web server that is fired up.

https://github.com/staxmanade/StatLight/tree/master/src/StatLight.RemoteIntegration/StatLight.RemoteIntegration.Web

The psake task [test-remote-access-querystring] is a powershell test that starts the remote web server, and then fires up statlight.

https://github.com/staxmanade/StatLight/blob/master/default.ps1#L820

Hope this helps.

Aug 8, 2011 at 5:39 PM

Ok, sorry my ignorance but I thought after firing StatLight with my own xap I would get everything running 'out of the box',

What do you mean when you say StatLight uses a webserver for it's own use?

I have a web application running on http://localhost/ServerApp/ and that's where my xap is. My RIA services are exposed in that app. also, I have another web app on http://localhost/Tests which is where the Silvrlight Test app is hosted. I wrote my tests there to access the services running on the first app.

So, the question is, what should I do in order to get StatLight run my SL test app up & running against my services?

If is there documentation explaining this and I missed it, please let me know... I did download the solution, and it is pretty big :) (will take a look at whant you mentioned before though)

Coordinator
Aug 8, 2011 at 7:00 PM

I don't have any documentation regarding your specific scenario, as it's not how people typically setup "unit testing" however it is something that is possible, and every situation will be different enough that It's a tough one to document a specific how-to.

Regarding statlight spinning up it's own web server, it's basically starting an HttpListener, and listening to a certain class of requests (those needed for StatLight to capture test results). Any other request is written to the log as an unknown request (as you saw before).

StatLight is designed to pick up your test xap from a file location (so you can't point statlight to talk to a http://localhost/testapp/test.xap) location. If you take a look at the diagram on the documentation home page, it might help you get a good mental picture of what the larger components of StatLight are. 

Good luck.

Aug 8, 2011 at 8:48 PM

Ok, will take a look at everything you told me.

You mentioned it's not how most people use StatLight... how do they use it? what am I doing wrong? (or different)

Regards