mstest

Passing a parameter to MSTests using MSBuild

霸气de小男生 提交于 2019-12-11 15:52:29
问题 I've got an issue that was wondering if could be solved in a particular way. I would like to be able to pass a parameter or set some kind of variable in an MSBuild script that will be run on a TeamBuild server. This parameter would be used as a condition in the setup of a TestFixture in MSTest to decided which concrete implementation of a class to be used. It would be a mock version when running on the build server, and a reference to a physical asset when running on a developer machine. Is

c# - selenium - MSTest - Unable to add a result file ( using testcontext.AddResultFile ) to the report using testcontext

爱⌒轻易说出口 提交于 2019-12-11 13:46:16
问题 I am using MSTest - C# - Selenium to run a suite of tests. I am taking a screenshot if there is a failed step and wish to upload ( attach ) it with the trx file, All is good when I run it as a single test of a couple of tests and the results are with the attachment. But when I run the tests in Parallel, I am not able to see the result file with the attachment even though the test is FAILED I get the below in the trx file TestContext Messages: Value cannot be null. Parameter name: path The

Unit Testing, Web Services and Database Transactions

折月煮酒 提交于 2019-12-11 12:47:08
问题 I'm trying to write test cases for my web services in a way that I can rollback any database changes they may make. I can try to surround them with a transaction scope, but how do I specify a context for the transaction? In other words, how does the transaction know which database and server to rollback on? In my case, the SQL server runs locally as well as the web services. Before you tell me to call the web services directly without a client, please understand that the web services have

Microsoft Unit Tests - Data source cannot be found in the test configuration settings

会有一股神秘感。 提交于 2019-12-11 11:59:37
问题 I am trying to build Test class of data-driven unit tests in C#. I want to use 3 databases: one from SQL, one from Access and one from Excel. This is my app.config file: <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section name="microsoft.visualstudio.testtools" type="Microsoft.VisualStudio.TestTools.UnitTesting.TestConfigurationSection, Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral"/> </configSections> <connectionStrings

Can't run Unit Tests In VS2012RC

妖精的绣舞 提交于 2019-12-11 11:01:57
问题 I'm trying to run my unit tests for a Windows 8 Metro Class library i get the following 2 errors in the output window: Output: ------ Run test started ------ Error : DEP3000 : Attempts to stop the application failed. This may cause the deployment to fail. App Packages may only be shutdown as part of a Visual Studio build operation. Failed to activate Metro style unit test executor. Error: The application cannot be started. Try reinstalling the application to fix the problem. ========== Run

How to load test a web page using Windows authentication

跟風遠走 提交于 2019-12-11 10:45:26
问题 I'm in the process of developing some load tests for an internal web application. The problem appears to be related to our use of Windows authentication. I can access the web application if I launch the browser and nevigate to our app. I can't, however, access the application via webrequest in my load test. It throws a 401 exception, Unauthorized. I'm using Visual Studio 2010 Ultimate. How do I use my Windows credentials in my load test? Any other ideas? 回答1: Select The Test Main node, and

Adding result files to TestContext in AssemblyCleanup

亡梦爱人 提交于 2019-12-11 08:13:52
问题 I'm trying to add files to a test run to be shown in TFS, as opposed to adding them to an individual test. Adding files only to the last test would also be an option. By storing the TestContext of MSTest in a static variable, I can access it in the AssemblyCleanup method of my test class and use AddResultFile() to add my files. However, the files do not appear as attachment of the test run in TFS' web UI, and also do not appear as attachment of the last test. Any way to attach files once in a

How to write unit test for method in back of windows form code

萝らか妹 提交于 2019-12-11 07:31:02
问题 I have method I want to test and I get this error "Invoke or BeginInvoke cannot be called on a control until the window handle has been created." Now I also have a list box that is being populated inside that function I am testing. So its an issue when I separate the Method to another class. I understand this because of the form needs to run first, but any alternatives? public partial class ImportForm : Form { public ImportForm() { } public bool Test(string[] fileNames)//Method to test {

No Coverage Data for Tests in Current Context

匆匆过客 提交于 2019-12-11 07:27:00
问题 I'm using Visual Studio 2010 SP1. When I run "All Tests in Solution", I get code coverage results to show up just fine. However, when I run a subset of tests using "Tests in Current Context", I only see "Cannot find any coverage data (.coverage or .coveragexml) files. Check test run details for possible errors." A Google search shows that others do get code coverage results when running a subset of tests. Is there a configuration I'm missing somewhere? 回答1: I think I figured out the reason

Data driven tests using nested xml data file

孤街醉人 提交于 2019-12-11 06:59:02
问题 I need to write a unit test driven by a data file that contains collections of data. For obvious reasons a csv file isn't appropriate, but XML suggests itself. However I can't seem to get it to work. Here's a fragment of the data file (only one test record shown): <?xml version="1.0" encoding="utf-8" ?> <testData> <testRecord> <displayColumnNames> <name>Include</name> <name>SampleInt1</name> <name>SampleInt2</name> <name>SampleInt3</name> <name>SampleInt4</name> <name>SampleInt5</name> <