Running with SilverLight custom web.config/MVVM

Apr 4, 2011 at 1:28 PM

Hello,

I just came across this project and believe it will help us with getting our Silverlight Automated Tests in a CI process.  I downloaded the application and have been able to get it to execute, but my tests are failing (they normally pass through the UI execution).  We do use a custom web.config, not sure if that has any bearing.

So I am seeing two predominate issues.

1) Tests will fail with:

The provided URI scheme 'file' is invalid; expected 'http'.
Parameter name: via

at System.ServiceModel.Channels.TransportChannelFactory`1.ValidateScheme(Uri via)
at System.ServiceModel.Channels.HttpChannelFactory.ValidateCreateChannelParameters(EndpointAddress remoteAddress, Uri via)
at System.ServiceModel.Channels.HttpChannelFactory.OnCreateChannel(EndpointAddress remoteAddress, Uri via)
at System.ServiceModel.Channels.ChannelFactoryBase`1.InternalCreateChannel(EndpointAddress address, Uri via)
at System.ServiceModel.Channels.ChannelFactoryBase`1.CreateChannel(EndpointAddress address, Uri via)
at System.ServiceModel.Channels.ServiceChannelFactory.ServiceChannelFactoryOverRequest.CreateInnerChannelBinder(EndpointAddress to, Uri via)
at System.ServiceModel.Channels.ServiceChannelFactory.CreateServiceChannel(EndpointAddress address, Uri via)
at System.ServiceModel.ClientBase`1.ChannelBase`1..ctor(ClientBase`1 client)
at Bsi.Build2Win.Instrumentation.TestInstrumentationWebServices.TestInstrumentationWebServiceSoapClient.TestInstrumentationWebServiceSoapClientChannel..ctor(ClientBase`1 client)
at Bsi.Build2Win.Instrumentation.TestInstrumentationWebServices.TestInstrumentationWebServiceSoapClient.CreateChannel()
at System.ServiceModel.ClientBase`1.get_Channel()
at Bsi.Build2Win.Instrumentation.TestInstrumentationWebServices.TestInstrumentationWebServiceSoapClient.Bsi.Build2Win.Instrumentation.TestInstrumentationWebServices.TestInstrumentationWebServiceSoap.BeginSaveInstrumentationServerErrorSettings(SaveInstrumentationServerErrorSettingsRequest request, AsyncCallback callback, Object asyncState)
at Bsi.Build2Win.Instrumentation.TestInstrumentationWebServices.TestInstrumentationWebServiceSoapClient.OnBeginSaveInstrumentationServerErrorSettings(Object[] inValues, AsyncCallback callback, Object asyncState)
at System.ServiceModel.ClientBase`1.InvokeAsync(BeginOperationDelegate beginOperationDelegate, Object[] inValues, EndOperationDelegate endOperationDelegate, SendOrPostCallback operationCompletedCallback, Object userState)

2) Running through Lighthouse does not appear to find or be able to see the MVVMs for the application I am testing.  When checking that View models are not Null the test fails.

Assert.IsNotNull failed. Expected ViewModel instance, but found null.

The tests appear to execute based on the xml, but result is an Error

executed="True" result="Error" success="False" time="0.141" asserts="0" 

Any help would be greatly appreciated. I am currently configuring this on a local host where I develop the automation tests and typically run the execution of them.

Thanks!


Coordinator
Apr 4, 2011 at 1:44 PM

Hi,

if you could post here some sample SL project with examples of tests failing it would really be helpful to fix this.

Im pretty confident that first issue is related to custom web.config but its hard to see why without example.

Second issue could be because your IOC initialization is not called?

Anyway thanks for reporting and please try to create small example app that with tests that fails with Lighthouse and attach it to this thread and i will try to fix it.

Apr 4, 2011 at 5:16 PM

It will take me some time to pull this together, but my feeling is that it is not getting information from the ServiceReferences.ClientConfig file, nor the Web.Config file.

Specifically in my ServiceReferences.ClientConfig I point to:

            <endpoint address="http://localhost:2793/InstrumentationServices/TestInstrumentationWebService.asmx"
                      binding="basicHttpBinding"
                      bindingConfiguration="TestInstrumentationWebServiceSoap"
                      contract="TestInstrumentationWebServices.TestInstrumentationWebServiceSoap"
                      name="TestInstrumentationWebServiceSoap" />

The tests use this to access instrumentation methods that we have developed.

My guess is that it is trying to find the instrumentation as a file path.

Let me know if this helps, otherwise I will see what I can do to provide something that you can see.

Coordinator
Apr 4, 2011 at 10:13 PM

Its really hard to figure it out without example so please try to assemble something as simple as possible that shows the error.

I would even split it in two small projects one for web service problem, one for the mvvm problem so we can track this as separate issues.

Btw, im not sure what you are doing with web services, but general rule of thumb is that you dont call real web services from your unit tests.

You should mock them with some fake services with fake responses (for example with Rhino Mocks) and call this instead.

Real web services you should only call in integration tests.

Just my two cents.

Thanks for your feedback.