{"id":17787780,"url":"https://github.com/icnocop/silverlightunittestadapter","last_synced_at":"2025-08-24T13:47:17.816Z","repository":{"id":29848506,"uuid":"122937393","full_name":"icnocop/SilverlightUnitTestAdapter","owner":"icnocop","description":"Visual Studio Unit Test Adapter for Silverlight 5","archived":false,"fork":false,"pushed_at":"2022-12-18T06:23:13.000Z","size":915,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-14T10:56:50.526Z","etag":null,"topics":["silverlight","unit-test","visual-studio"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/icnocop.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-26T08:24:16.000Z","updated_at":"2022-03-21T16:09:20.000Z","dependencies_parsed_at":"2023-01-14T15:46:12.643Z","dependency_job_id":null,"html_url":"https://github.com/icnocop/SilverlightUnitTestAdapter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/icnocop/SilverlightUnitTestAdapter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icnocop%2FSilverlightUnitTestAdapter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icnocop%2FSilverlightUnitTestAdapter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icnocop%2FSilverlightUnitTestAdapter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icnocop%2FSilverlightUnitTestAdapter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/icnocop","download_url":"https://codeload.github.com/icnocop/SilverlightUnitTestAdapter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icnocop%2FSilverlightUnitTestAdapter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265819808,"owners_count":23833553,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["silverlight","unit-test","visual-studio"],"created_at":"2024-10-27T10:12:39.815Z","updated_at":"2025-07-18T19:32:31.562Z","avatar_url":"https://github.com/icnocop.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ![Logo](logo.png) Silverlight Unit Test Adapter\n\nVisual Studio Unit Test adapter for Silverlight 5\n\n[![Build](https://github.com/icnocop/SilverlightUnitTestAdapter/actions/workflows/build.yml/badge.svg)](https://github.com/icnocop/SilverlightUnitTestAdapter/actions/workflows/build.yml)\n[![Visual Studio Marketplace Downloads](https://img.shields.io/visual-studio-marketplace/d/RamiAbughazaleh.SilverlightUnitTestAdapter)](https://marketplace.visualstudio.com/items?itemName=RamiAbughazaleh.SilverlightUnitTestAdapter)\n[![Visual Studio Marketplace Installs](https://img.shields.io/visual-studio-marketplace/i/RamiAbughazaleh.SilverlightUnitTestAdapter)](https://marketplace.visualstudio.com/items?itemName=RamiAbughazaleh.SilverlightUnitTestAdapter)\n[![Open VSIX Gallery](https://img.shields.io/badge/dynamic/xml?label=nightly\u0026query=%2F%2A%5Blocal-name%28.%29%3D%27feed%27%5D%2F%2A%5Blocal-name%28.%29%3D%27entry%27%5D%5B1%5D%2F%2A%5Blocal-name%28.%29%3D%27Vsix%27%5D%2F%2A%5Blocal-name%28.%29%3D%27Version%27%5D\u0026url=http%3A%2F%2Fvsixgallery.com%2Ffeed%2Fextension%2FSilverlight%2520Unit%2520Test%2520Adapter.7bc66174-d984-421f-8bb7-42a7fe553d4a)](http://vsixgallery.com/extension/Silverlight%20Unit%20Test%20Adapter.7bc66174-d984-421f-8bb7-42a7fe553d4a/)\n\n![Screenshot](Installer/Screenshot.png?raw=true)\n\n## Supported Visual Studio Versions\n\nVisual Studio 2015  \nVisual Studio 2017  \nVisual Studio 2019  \nVisual Studio 2022  \n\n## Visual Studio Requirements\n\nTools \u003e Options... \u003e Test \u003e Un-check \"For improved performance, only use test adapters in test assembly folder or as specified in runsettings file\".\n\nOtherwise the following error occurs when trying to run a test:  \n`Could not find test executor with URI 'executor://statlighttestadapter/v1'. Make sure that the test executor is installed and supports .net runtime version .`\n\n## Installation\n\nThe Visual Studio extension requires elevation during install and will be installed for all users in a subfolder in Visual Studio's extension directory.\n\nFor example, \"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\IDE\\Extensions\\\\{8.3}\", where \"{8.3}\" is an arbitrary directory.\n\n## Creating a Silverlight unit test project\n\n1. Download and install [Silverlight 5 Toolkit (December 2011)](https://github.com/MicrosoftArchive/SilverlightToolkit/releases/download/5/Silverlight_5_Toolkit_December_2011.1.msi).  \n\n2. Create a new `Silverlight Class Library` project in Visual Studio.\n\n3. Add a project reference to `Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll` from the Silverlight Toolkit installation directory.\n\n   For example, `C:\\Program Files (x86)\\Microsoft SDKs\\Silverlight\\v5.0\\Toolkit\\dec11\\Testing\\Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll`.\n\n4. Create a new class for the unit test:\n```\nusing System;\nusing System.Diagnostics;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace SilverlightUnitTest\n{\n    [TestClass]\n    public class UnitTest1\n    {\n        [TestMethod]\n        public void TestMethod1()\n        {\n            this.Log(\"Hello from Silverlight!\");\n            \n            Assert.IsTrue(true, \"Testing is fun!\");\n        }\n\n        private void Log(string message)\n        {\n            // write message to the Debug window when run with the debugger\n            Debug.WriteLine(message);\n\n            // write message to the Tests output window when run without the debugger\n            Console.WriteLine(message);\n        }\n    }\n}\n```\n5. `Build` the project and notice the new test method appear in the `Test Explorer` window in Visual Studio.\n\n## Configuration\n\nThe Silverlight unit test adapter reads configuration settings from `SilverlightUnitTestAdapter.json`.\nThis file must be placed in the same path as the test assembly.\n\n### Debug\n\nEnabling StatLight's `Debug` property outputs verbose information to the Output window's \"Test\" pane which can be used for troubleshooting.\n\n###### Example\n```\n{\n  \"Debug\": true\n}\n```\n\n### Override StatLight settings\n\nAdditional StatLight settings can be overriden using the `OverriddenSettings` property.\n\n| Key                                            | Default value | Description |\n|------------------------------------------------|---------------|-------------|\n| Windowless                                     | false         | Sets the [windowless](https://msdn.microsoft.com/es-es/library/cc838156(v=vs.95).aspx) property of the Silverlight application. |\n| MaxWaitTimeAllowedBeforeCommunicationErrorSent | 00:05:00      | The maximum amount of time of inactivity until the test times out. The default value is 5 minutes. This value is parsed as a [TimeSpan](https://msdn.microsoft.com/en-us/library/se73z7b9(v=vs.110).aspx#Anchor_2). |\n\n\n###### Example\n```\n{\n  \"OverriddenSettings\" : {\n    \"MaxWaitTimeAllowedBeforeCommunicationErrorSent\": \"00:20:00\"\n  }\n}\n```\n\n### Unit Test Provider\n\nStatLight will automatically detect the unit test provider to use by default.\n\nThe unit test provider type can be explicitly set by specifying it in the `UnitTestProvider` property.\n\n| Value                    | Description |\n|--------------------------|-------------|\n| MSTest                   | [Microsoft's Silverlight Toolkit](https://github.com/MicrosoftArchive/SilverlightToolkit) |\n| XUnit                    | [XUnit](https://xunit.github.io/) |\n| XUnitLight               | [XUnitLight.Silverlight](https://github.com/staxmanade/StatLight/tree/master/src/TestingFrameworkAdapters/XunitLight.Silverlight) |\n| NUnit                    | [NUnit](http://nunit.org/) |\n| UnitDriven               | [UnitDriven](https://archive.codeplex.com/?p=unitdriven) |\n| MSTestWithCustomProvider | Automatically searches your test assemblies for an IUnitTestProvider. |\n\n###### Example\n```\n{\n  \"UnitTestProvider\": \"MSTestWithCustomProvider\"\n}\n```\n\n### Query String\n\nName-value pairs specified in the `QueryString` property can be retrieved using the `HtmlPage.Document.QueryString` property in the test assembly.\nThis allows you to pass arbitrary information to the assembly and methods under test.\n\n###### Example\n```\n{\n  \"QueryString\": {\n    \"name1\": \"value1\",\n    \"name2\": \"value2\"\n  }\n}\n```\n\n### Plugins\n\nThe Silverlight unit test adapter can be extended by using plugins.\nPlugins can be used to manipulate the test results as a way to work-around some of the limitations when running unit tests in Silverlight.\nPaths can be specified relative to the test assembly.\n\n###### Example\n```\n{\n  \"Plugins\": [\n    \"..\\\\..\\\\plugin1.dll\",\n    \"..\\\\..\\\\plugin2.dll\"\n  ]\n}\n```\n\n#### Creating a plugin\n\n1. Create a new .NET 3.5+ Class Library project.\n2. Install the [SilverlightUnitTestAdapter.Plugin](https://www.nuget.org/packages/SilverlightUnitTestAdapter.Plugin/) NuGet package.\n3. Create the class that defines the plugin using the `IPlugin` interface.\n\n```\nusing SilverlightUnitTestAdapter.Plugin;\nusing Microsoft.VisualStudio.TestPlatform.ObjectModel;\nusing Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging;\n\npublic class Plugin : IPlugin\n{\n    public void TransformTestResult(IMessageLogger logger, TestResult testResult)\n    {\n        // write messages to Visual Studio's Test Output window\n        logger.SendMessage(TestMessageLevel.Informational, \"Transforming test result...\");\n\n        // get test assembly file path\n        string testAssemblyFilePath = testResult.TestCase.Source;\n\n        // get the test name\n        string testName = result.TestCase.FullyQualifiedName;\n\n        // get/set the test outcome (Passed, Failed, Skipped, etc.)\n        Microsoft.VisualStudio.TestPlatform.ObjectModel.TestOutcome testOutcome = testResult.Outcome;\n\n        // get/set the error message\n        string errorMessage = testResult.ErrorMessage;\n\n        // get/set the error stack trace\n        string errorStackTrace = testResult.ErrorStackTrace;\n\n        // add/remove attachments\n        AttachmentSet attachmentSet = new AttachmentSet(new Uri(\"attachment://dummy\"), \"attachment\");\n        Uri testFile = new Uri(@\"C:\\file.txt\", UriKind.Absolute);\n        attachmentSet.Attachments.Add(new UriDataAttachment(testFile, \"file.txt\"));\n        testResult.Attachments.Add(attachmentSet);\n\n        // write messages to the test Output in the \"Standard Output\" category\n        result.Messages.Add(new TestResultMessage(TestResultMessage.StandardOutCategory, \"Standard Out\"));\n\n        // write messages to the test Output in the \"Standard Error\" category\n        result.Messages.Add(new TestResultMessage(TestResultMessage.StandardErrorCategory, \"Standard Error\"));\n    }\n}\n\n```\n4. Add the path to the plugin dll in `SilverlightUnitTestAdapter.json`.\n\n### Displaying exception stack trace with line numbers\n\n1. Catch the exception in the unit test and generate an exception report using [Production Stack Trace PR#13](https://github.com/gimelfarb/ProductionStackTrace/pull/13).\n2. Re-throw a new exception that contains the exception report in the new exception's `Message`.\n3. Create a plugin that uses [Production Stack Trace](https://github.com/gimelfarb/ProductionStackTrace) to convert the `ErrorMessage` property of the `TestResult` parameter and set the translated stack trace to the `ErrorStackTrace` property.\n\n## Limitations\n\n- Silverlight tests can't run with elevated permissions.\n- Silverlight tests can't run as a trusted application.\n- Silverlight tests can't run in parallel.\n- Silverlight tests can't be cancelled.\n\n## Troubleshooting\n\nDetailed messages are written in the Output window's \"Test\" pane.\n\nEnable the `Debug` property in the configuration file to display more verbose information.\n\nEnable unit test explorer logs for more diagnostic messages.\nhttps://blogs.msdn.microsoft.com/aseemb/2012/03/01/how-to-enable-ute-logs/\n\n## Debugging in development\n\nRun an experimental instance of Visual Studio, where the VSIX package is automatically installed when building the Installer project.\n\nFor example,\n\"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\IDE\\devenv.exe\" /RootSuffix Exp\n\nOtherwise the following error occurs when trying to run a test:  \n`Could not find test executor with URI 'executor://statlighttestadapter/v1'. Make sure that the test executor is installed and supports .net runtime version .`\n\n## Resources\n\n[Silverlight Documentation and Downloads](https://msdn.microsoft.com/en-us/library/cc838158(v=vs.95).aspx)\n\n[Silverlight Toolkit GitHub repository](https://github.com/MicrosoftArchive/SilverlightToolkit)\n\n[Silverlight Discussion Forums](http://forums.silverlight.net/forums/35.aspx)\n\n[Silverlight Toolkit CodePlex Archive](https://archive.codeplex.com/?p=silverlight)\n\n## Credits\n\n[Niels Hebling](https://nielshebling.de) for [Silverlight Unit Test Adapter for Visual Studio 2012](https://marketplace.visualstudio.com/items?itemName=nielshebling.SilverlightUnitTestAdapter)\n\n[Jason Jarrett](https://github.com/staxmanade) and contributors for [Silverlight Testing Automation Tool (StatLight)](https://github.com/staxmanade/StatLight)\n\n[Steven De Kock](https://twitter.com/sdekock) and [Matt Ellis](https://twitter.com/citizenmatt) for [AgUnit](https://github.com/sdekock/AgUnit)\n\n[Lev Gimelfarb](http://www.lionhack.com/) for [Production Stack Trace](https://github.com/gimelfarb/ProductionStackTrace)\n\n[PSD Graphics](http://www.psdgraphics.com/) for blue box icon\n\nThe Visual Studio logo is a trademark of Microsoft Corporation.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficnocop%2Fsilverlightunittestadapter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ficnocop%2Fsilverlightunittestadapter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficnocop%2Fsilverlightunittestadapter/lists"}