Statlight for Silverlight 5

Sep 7, 2011 at 1:10 AM

Hi,

Do we have a Statlight build for Silverlight 5?. 

 

Thanks,

Krishna.

Coordinator
Sep 7, 2011 at 2:32 PM

Not yet. Will see if I can find some time in the next couple weeks.

Sep 9, 2011 at 11:55 PM

Thanks! That will be very helpfull.

Coordinator
Oct 4, 2011 at 5:36 AM

Has anyone tried the current version of StatLight with SL5? Does it not work? If not, what problems are you experiencing?

Oct 4, 2011 at 10:50 PM

I am able to run SL5 tests using StatLight version 1.5.4260. 

Thanks a lot staxmanade.

Oct 5, 2011 at 12:00 AM
Edited Oct 5, 2011 at 10:13 PM

Hi Staxmanade. That worked fine for a simple SL 5 test project. But when my tests targeted SL 5 controls and toolkits, i am getting the below exception. Please let me know if additional information is required. 

 

********************* ReflectionTypeLoadException *******************

***** Begin Loader Exception Messages ***** 

 -  Could not load file or assembly 'System.Windows.Controls, Version=5.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The requested assembly version conflictswith what is already bound in the app domain or specified in the manifest. (Exception from HRESULT:0x80131053)   -  Could not load file or assembly 'System.Windows.Controls.Input.Toolkit, Version=4.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find thefile specified.


***** End Loader Exception Messages *****

 

And subsequently all my tests fails with the below exception.

System.TypeInitializationException: The type initializer for 'Microsoft.XXXX.XXXX.XXXX.XXX.TestTools.TestConfiguration' threw an exception. ---> System.IO.FileLoadException: Could not load file or assembly 'System.Xml.Linq, Version=5.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The requested assembly version conflicts with what is already bound in the app domain or specified in the manifest. (Exception from HRESULT: 0x80131053)

Coordinator
Oct 5, 2011 at 3:41 PM

That exception helps. I'll dig in and see what it'll take to get a SL5 build of StatLight going.

Thanks

Oct 5, 2011 at 10:47 PM

Hi Staxmanade,

To my knowledge, there is only one change that needs to be done to make StatLight to work against SL 5 projects.

1. Change the SL assembly reference location (as shown below) in 'default.ps1' file (pre req: Install SL 5 SDK)

 

$silverlight_core_assemblies_location = "$program_files_dir\Reference Assemblies\Microsoft\Framework\Silverlight\v5.0"
$silverlight_libraries_client_assemblies = "$program_files_dir\Microsoft SDKs\Silverlight\v5.0\Libraries\Client"

 

The Silverlight unit test framework related assemblies remains the same from previous version. So there is no change required here.

Also, its a good idea to change the 'Target Silverlight Version' of Silverlight projects in StatLight to version 5. Although this is not necessary unless you want to add SL 5 specific changes to StatLight.

Coordinator
Oct 9, 2011 at 4:15 AM

I've done some work to get SL5 working. Could you download and build the following branch and let me know if this version of StatLight works for you?

https://github.com/staxmanade/statlight/tree/sl5

Thanks

Oct 10, 2011 at 5:51 PM

I am getting the below build error.

 

"E:\depot\ThirdParty\staxmanade-StatLight-sl5\src\StatLight.sln" (Rebuild target) (1) ->
"E:\depot\ThirdParty\staxmanade-StatLight-sl5\src\StatLight.IntegrationTests\StatLight.IntegrationT
ests.csproj.metaproj" (Rebuild target) (5) ->
"E:\depot\ThirdParty\staxmanade-StatLight-sl5\src\StatLight.IntegrationTests\StatLight.IntegrationT
ests.csproj" (Rebuild target) (17) ->
(_CopyOutOfDateSourceItemsToOutputDirectory target) ->
  C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(3129,9): error MSB3021: Unable to copy file "E
:\depot\ThirdParty\staxmanade-StatLight-sl5\src\StatLight.IntegrationTests.Silverlight.MSTest\StatL
ight.IntegrationTests.Silverlight.MSTest-SL5.xap" to "..\build\bin\Debug\ProviderTests\_testXaps\StatLight.IntegrationT
ests.Silverlight.MSTest-SL5.xap". Could not find file 'E:\depot\ThirdParty\staxmanade-StatLight-sl5
\src\StatLight.IntegrationTests.Silverlight.MSTest\StatLight.IntegrationTests.Silverlight.MSTest-SL5.xap'. [E:\depot\ThirdParty\staxmanade-StatLight-sl5\src\StatLight.IntegrationTests\StatLight.IntegrationTests.csproj]

    7 Warning(s)
    1 Error(s)

Time Elapsed 00:00:16.16
default.ps1:msbuild failed on StatLight.sln


Coordinator
Oct 11, 2011 at 4:24 AM

Thanks, I had a build dependency issue where projects weren't built in the correct order. Cold you please try again.

Oct 12, 2011 at 11:31 PM

I am not able to download/locate the link to download the latest SL5 statlight code.

I did the following, but failed to get SL5 version.

1. naviagate to https://github.com/staxmanade/statlight/tree/sl5

2. Ensure the current branch is SL5

3. Downloaded using the 'ZIP' click near the 'https://github.com/staxmanade/StatLight.git' uri.

 

Please let me know how to access the SL5 version download.

 

Thanks much!.

Coordinator
Oct 13, 2011 at 5:33 AM
Edited Oct 13, 2011 at 5:14 PM

How to download the zip of a branch. Good question... I've posted this to the github support.

Until I hear back from them (if you are allowed to install git I'll give you the quick how to).

  1. Install Chocolatey (http://chocolatey.org/)
  2. type in a powershell cmd "chocolatey install msysgit"
  3. exit the powershell and restart the powershell.
  4. Go to a folder you'd like to checkout statlight to.
  5. type "git clone https://github.com/staxmanade/StatLight.git"
  6. type "cd StatLight"
  7. type "git checkout sl5"
  8. Now go try to build (using one of the bat files)

Hope this helps.

Oct 13, 2011 at 5:48 AM

The 6th step fails.

PS E:\depot\ThirdParty\Statlight-sl5> git checkout sl5

fatal: Not a git repository (or any of the parent directories): .git 

Coordinator
Oct 13, 2011 at 5:14 PM

I've edited the steps above (between 5&6 you have to change your directory to be in the StatLight folder)

Oct 15, 2011 at 2:35 AM

whew ... thats worked ... now we have Statlight for SL5 ... thanks a lot Jason!.

Coordinator
Oct 15, 2011 at 5:03 AM

Great news. Thanks...

What I'm going to do for now is keep this sl5 branch of code until SL5 officially comes out, if that's ok. After RTM of SL5, then I'll merge it in and try to get a build of it out the door.

Thanks again.

Nov 29, 2011 at 7:10 PM

Hi, I'm trying to get this branch to try StatLight with SL5 also.

I'm not familar with git at all, so this may be a dumb question, but I think I am failing during step 5. 

I get the message "warning: cannot get host name: No such file or directory"  Everything goes great up to that point.  Then, after doing step 6, I get the same error during step 7.

PS C:\WINDOWS\system32> cd 'C:\users\krautb1\Visual Studio 2010\Projects'
PS C:\users\krautb1\Visual Studio 2010\Projects> git clone https://github.com/staxmanade/StatLight.git
Cloning into StatLight...
remote: Counting objects: 7893, done.
remote: Compressing objects: 100% (2028/2028), done.
remote: Total 7893 (delta 6055), reused 7539 (delta 5710)
Receiving objects: 100% (7893/7893), 11.01 MiB | 172 KiB/s, done.
Resolving deltas: 100% (6055/6055), done.
warning: cannot get host name: No such file or directory
PS C:\users\krautb1\Visual Studio 2010\Projects> cd .\StatLight
PS C:\users\krautb1\Visual Studio 2010\Projects\StatLight> git checkout sl5
Branch sl5 set up to track remote branch sl5 from origin.
warning: cannot get host name: No such file or directory
Switched to a new branch 'sl5'
PS C:\users\krautb1\Visual Studio 2010\Projects\StatLight>

I checked default.ps1 before and after step 7 and it seems to have been changed, but I don't know if there are other files that should have been updated.

When I try to build with any of the .bat files I get several warnings and errors.  I can send you a log if you like.

Any help would be appreciated.  Thanks!

Nov 29, 2011 at 8:36 PM

OK, nevermind, my bad.  I moved the project to a path without spaces and the post-build errors went away.  I still get the warnings during the gits but I now can get a clean debug build.

The release builds throw 3 CA1704 errors but you probably know about that.

Sorry for the bother and thanks for providing this much needed tool!

Coordinator
Nov 30, 2011 at 2:46 AM

Thanks for the update on the CA1704. When SL5 rtm's I will go back in there and clean it up and try to get a new release out.

Dec 1, 2011 at 8:54 PM

Hello again, I've been working with this further and I can't get tests that use the TestPanel to work; they alway 'hang' and then time out after 5 minutes.  I'm using the -b option.

My tests run fine under v1.5.4260 built as SL4 apps but not under the latest 'regular' release (v1.5.4348) built as SL4 apps or under the git sl5 branch built as SL5 apps.

I'm also getting quite a few unit test failures on both the debug and release builds with the latest and sl5 branch sources.  (I suppressed the CS1704 errors on the Release build.)
I assume you're seeing these also, but if not maybe I have some environment problem?

Thanks

Coordinator
Dec 14, 2011 at 6:51 AM
Edited Dec 19, 2011 at 9:44 PM

Hey All you SL5 peeps. I actually did a ton of internals work over the weekend on StatLight. However didn't get to the SL5 branch until tonight. As of tonight I installed the RTM of SL5 and worked around some of my internal refactorings. If you want to give StatLight a go with SL5. Once I know that the build servers (TeamCity.CodeBetter.com) is up to date with SL5 I will merge this into master and probably generate an official release.

Until then you can follow the below steps to get a build that _should_ support SL5.

  1. Install Chocolatey (http://chocolatey.org/)
  2. type in a powershell cmd "chocolatey install msysgit"
  3. exit the powershell and restart the powershell. (this is to re-fresh environment variables)
  4. Go to a folder you'd like to checkout statlight to.
  5. type "git clone https://github.com/staxmanade/StatLight.git"
  6. type "cd StatLight"
  7. type "git checkout --track -b sl5 origin/sl5"
  8. Now go try to build (using one of the bat files)

Hope this helps

Dec 16, 2011 at 5:14 PM

I built the exe from the SL5 source. When I attempt to run it against a simple app with one assert true test I get the following:

A Silverlight MessageBox dialog was automatically closed.Caption: Unhandled Error in Silverlight ApplicationSuper Secret StatLight Code: 836D4425-DB59-48BB-BA7B-03AB20A57499Code: 2103Category: InitializeErrorMessage: Invalid or malformed application: Check manifest
Dialog Message:Message from webpage

Any ideas?

Coordinator
Dec 16, 2011 at 7:35 PM

Could you run it with the --debug option and post your results?

Dec 19, 2011 at 2:53 AM

I got a clean copy of the source, fixed the refs and did a clean build. Got everything to build and was able to run my first tests. Thank for your reply though.

Coordinator
Dec 19, 2011 at 5:06 AM

When you say fix up the references, what sort of fixes did you have make? Is it x86 vs x64? or something else? Thanks.

Dec 19, 2011 at 8:42 PM

I just tried to get the SL5 branch to give this a try and got the following response:

Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.

PS C:\WINDOWS\system32> cd \
PS C:\> git clone https://github.com/staxmanade/StatLight.git
Cloning into StatLight...
remote: Counting objects: 8424, done.
remote: Compressing objects: 100% (1927/1927), done.
remote: Total 8424 (delta 6495), reused 8252 (delta 6335)
Receiving objects: 100% (8424/8424), 12.03 MiB | 418 KiB/s, done.
Resolving deltas: 100% (6495/6495), done.
warning: cannot get host name: No such file or directory
PS C:\> cd .\StatLight
PS C:\StatLight> git checkout sl5
Branch sl5 set up to track remote branch sl5 from origin.
warning: cannot get host name: No such file or directory
Switched to a new branch 'sl5'
PS C:\StatLight>

I don't know much about git but it doesn't look like it actually got anything SL5 specific.

Building debug generates 16 Warnings and 134 Errors.  The errors are all CS0234 and CS246, "The type or namespace name ... could not be found ..."  I think this must be the reference fixes natificent is referring to.  This was a fresh clone/checkout as shown above.

Thanks.

Coordinator
Dec 19, 2011 at 9:46 PM

I updated step 7 above (let me know if this helps) with your git steps.

Could you give me the exact errors? (I understand that on your machines you must not have a reference to certain assemblies, I just want to know which ones and if either you'll have to install the necessary dependencies, or if I have some un-necessary assembly references in the projects somewhere.)

Dec 20, 2011 at 2:20 PM

I still don't get any updates.  I've included the PS output below.  I wish I knew more about git; sorry.

I took a look at the build errors and I think I may be missing one of the prerequitsites.  I'll look into this further and let you know how it goes.

Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.

PS C:\WINDOWS\system32> cd \
PS C:\> git clone https://github.com/staxmanade/StatLight.git
Cloning into StatLight...
remote: Counting objects: 8424, done.
remote: Compressing objects: 100% (1927/1927), done.
remote: Total 8424 (delta 6495), reused 8252 (delta 6335)
Receiving objects: 100% (8424/8424), 12.03 MiB | 510 KiB/s, done.
Resolving deltas: 100% (6495/6495), done.
warning: cannot get host name: No such file or directory
PS C:\> cd .\StatLight
PS C:\StatLight> git checkout --track -b sl5 origin/sl5
Branch sl5 set up to track remote branch sl5 from origin.
warning: cannot get host name: No such file or directory
Switched to a new branch 'sl5'
PS C:\StatLight> .\build-Debug.bat
Dec 20, 2011 at 9:18 PM

I uninstalled all versions of my SL related stuff (runtimes, SDKs, tools for VS, toolkits, etc.) and then re-installed from SL2 through SL5 in order using the Microsoft Silverlight x Tools for Visual Studio xxx installers.  When I try to build-Debug the trunk I still get the 16 Warnings and 134 Errors.  The reference problems are in StatLight.IntegrationTests.Silverlight.MSTest-SL4.csproj.  Apparently the location and folder names in lib\Silverlight\Mircosoft changed somewhere along the way.  The current project has this: <HintPath>..\..\lib\Silverlight\Microsoft\May2010\Microsoft.Silverlight.Testing.dll</HintPath>
and it should be this: <HintPath>..\..\..\lib\Silverlight\Microsoft\MSTest2010May\Microsoft.Silverlight.Testing.dll</HintPath>

I hope that was of some help.

Thanks.


 

Coordinator
Dec 21, 2011 at 12:36 AM

Looks like someone else has solved the issues and fixed it...

If you go to https://github.com/staxmanade/StatLight/network you can see that brumbfb has some commits that look like they fix the errors.

Try to get this branch of code and see if it builds https://github.com/brumfb/StatLight/tree/sl5

I'll try to pull his changes in shortly.

Coordinator
Dec 21, 2011 at 3:24 AM

Now I've pulled in these changes into SL5. Hopefully this helps.

Coordinator
Dec 21, 2011 at 3:52 AM

Strike that. I've merged the SL5 stuff into master and you should be able to pull the latest build from the teamcity site. (go to the statlight home page and click the hot off the build link)

Coordinator
Dec 21, 2011 at 4:37 AM

Hello All,

You should be able to use the latest 1.6 version of StatLight

http://statlight.codeplex.com/releases/view/73869

Dec 21, 2011 at 4:51 PM

Thanks for pulling this together for us!

Version 1.6 works good for me on SL4 projects, but when I run it against an SL5 project I get this error:

Could not determine the Microsoft testing framework version with a SHA1 hash of
'3DCDF4616E1AE9989BD99D7D3C5FE55044C44206'

If I specify -v="MSTest2011December" it works fine. My SL5 Toolkit is the December 2011 version from http://silverlight.codeplex.com/releases/view/78435

Thanks

Coordinator
Dec 21, 2011 at 6:38 PM

Thanks for pointing this issue out. I think I see why it's failing. Not sure why my test suite didn't catch this issue. I'll try to have a fix shortly

Coordinator
Dec 21, 2011 at 6:49 PM
Edited Dec 21, 2011 at 6:49 PM

Can you re-try the 1.6 download now? I put in a fix that _should_ work. (Being careful about saying it does work - as I coded/pushed to production w/out testing :))

Dec 21, 2011 at 7:05 PM

Works now for me!  Thanks.

Dec 23, 2011 at 5:02 PM

I'm trying to do UI testing now and can not seem to get StatLight to run any tests where I use the TestPanel and wait for an event, e.g. Loaded.  The tests run fine with the Silverlight Test Framework runner.  I specify the -b option but StatLight still gives me the "Looks like your trying to use the Silverlight Test Framework's TestPanel...." message and then times out after 5 minutes.  The browser window is displayed, Silverlight is loaded, but the page is not displayed.  I've tried both the technique shown below and the technique of setting a flag on the load event and then using EnqueueConditional.  Test and console output is below.  (Very minor editorial comment - the "your" in the above message should be "you are" or "you're").  Thanks.

        [TestMethod]
        [Asynchronous]
        public void TestMethod1()
        {
            var page = new MainPage();
            page.Loaded += (o, e) =>
                {
                    this.EnqueueCallback(() => Assert.AreEqual(0, 0));
                    this.EnqueueTestComplete();
                };

            this.TestPanel.Children.Add(page);
        }

C:\Users\krautb1\Downloads\StatLight.v1.6.4372.22990-53a967c>statlight -x="C:\Us
ers\krautb1\Visual Studio 2010\Projects\StatLightSilverlightApplication\Silverli
ghtTest\Bin\Debug\SilverlightTest.xap" --debug -b

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

****************** Input options as configured ******************
ContinuousIntegrationMode          : False
DllPaths                           : IEnumerable
                                     {
                                     }
ForceBrowserStart                  : False
IsRequestingDebug                  : True
MethodsToTest                      : IEnumerable
                                     {
                                     }
MicrosoftTestingFrameworkVersion   :
NumberOfBrowserHosts               : 1
OutputForTeamCity                  : False
QueryString                        :
ReportOutputFileType               : StatLight
ReportOutputPath                   :
StartWebServerOnly                 : False
TagFilters                         :
UnitTestProviderType               : Undefined
UseRemoteTestPage                  : False
WebBrowserType                     : SelfHosted
WindowGeometry                     : StatLight.Core.Configuration.WindowGeometry

XapPaths                           : IEnumerable
                                     {
                                       'C:\Users\krautb1\Visual Studio 2010\Proj
ects\StatLightSilverlightApplication\SilverlightTest\Bin\Debug\SilverlightTest.x
ap'
                                     }
*****************************************************************
Starting configuration for: C:\Users\krautb1\Visual Studio 2010\Projects\StatLig
htSilverlightApplication\SilverlightTest\Bin\Debug\SilverlightTest.xap
XapItems.FilesContainedWithinXap = AppManifest.xaml
XapItems.FilesContainedWithinXap = Microsoft.Silverlight.Testing.dll
XapItems.FilesContainedWithinXap = Microsoft.VisualStudio.QualityTools.UnitTesti
ng.Silverlight.dll
XapItems.FilesContainedWithinXap = SilverlightTest.dll
XapItems.FilesContainedWithinXap = StatLightSilverlightApplication.dll
Incoming Microsoft.Silverlight.Testing.dll file's hash = 3DCDF4616E1AE9989BD99D7
D3C5FE55044C44206
RunnerType = OneTimeConsole
Attempting to open port at http://localhost:8887/
testPageUrlWithQueryString = http://localhost:8887/GetHtmlTestPage?
IRunner typeof(OnetimeRunner)


Starting Test Run: 12/23/2011 10:29:07 AM

Listening on http://localhost:8887/
Loading XapHost file [MSTest2011December]
Loading XapHost [C:\Users\krautb1\Downloads\StatLight.v1.6.4372.22990-53a967c\St
atLight.Client.For.MSTest2011December.xap]
XapItems.FilesContainedWithinXap = AppManifest.xaml
XapItems.FilesContainedWithinXap = Microsoft.Silverlight.Testing.dll
XapItems.FilesContainedWithinXap = Microsoft.VisualStudio.QualityTools.UnitTesti
ng.Silverlight.dll
XapItems.FilesContainedWithinXap = SilverlightTest.dll
XapItems.FilesContainedWithinXap = StatLightSilverlightApplication.dll
re-writing host xap with the following files
    -  already has file AppManifest.xaml
    -  already has file Microsoft.Silverlight.Testing.dll
    -  already has file Microsoft.VisualStudio.QualityTools.UnitTesting.Silverli
ght.dll
    add -  SilverlightTest.dll
        updated AppManifest - SilverlightTest
    add -  StatLightSilverlightApplication.dll
        updated AppManifest - StatLightSilverlightApplication

Looks like your trying to use the Silverlight Test Framework's TestPanel. To use
 this you will need to use the -b option in StatLight
^C
C:\Users\krautb1\Downloads\StatLight.v1.6.4372.22990-53a967c>
Coordinator
Dec 23, 2011 at 6:17 PM

Hey BruceKr,

Thanks for the report. For future ones would you mind posting new discussions?

If you need it working ASAP. I'll outline what you can change. I can't get to it till later this next week.

The problem is here.

https://github.com/staxmanade/StatLight/blob/master/src/StatLight.Client.Harness.MSTest/MSTestRunnerHost.cs#L134

This code

if (!_clientTestRunConfiguration.ShowTestingBrowserHost)

That if should look more like

if (!_clientTestRunConfiguration.WindowGeometry.ShouldShowWindow)

I need to get in there and remove the "ShowTestingBrowserhost" property.

My Bad... (yet another strange bug to get. I _should_ have test coverage for this case. bummer)

Coordinator
Dec 24, 2011 at 6:43 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Coordinator
Dec 26, 2011 at 4:38 AM

FYI: The new build should have this U.I. test issue fixed.

Jan 3, 2012 at 2:53 PM

Hi Jason, I just got back from vacation and gave this a try.  Works like a charm; thanks.  Happy New Year!