mstest

Attribute filter syntax for code coverage in TeamCity

送分小仙女□ 提交于 2019-12-05 02:46:59
Anyone knows the syntax for excluding code from coverage in Teamcity? I am using the ExcludeFromCodeCoverageAttribute on certain methods and want those excluded. It works well in Visual Studio but I don't understand how to get the same behavior in TeamCity. The Field I am trying to configure is located in MsTest -> .Net Coverage -> Attribute Filters: I have tried this: -:ExcludeFromCodeCoverageAttribute and this -:ExcludeFromCodeCoverage After trying out a few variations this worked: -:System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute Make sure you add this filter inside

Missing Method Exception When Referencing .Net Standard Project From .Net 4.6.1 Unit Test

。_饼干妹妹 提交于 2019-12-05 02:23:14
I am getting the following exception when running a .Net 4.6.1 unit test that uses System.IO.Compression.ZipFile.Open , if the unit test project references a .Net Standard 2.0 assembly: System.MissingMethodException: Method not found: 'System.IO.Compression.ZipArchive System.IO.Compression.ZipFile.Open(System.String, System.IO.Compression.ZipArchiveMode)'. at UnitTestProject.UnitTest1.TestMethod1() The unit test project was created using the VS 2017 Unit Test project (not the .NET Core one) and references were added to System.IO.Compression.FileSystem and my standard class library: using

How to run ClassCleanup (MSTest) after each class with test?

[亡魂溺海] 提交于 2019-12-05 01:59:08
I have several classes with tests suites. Each test class starts from ClassInitialize and finishes by ClassCleanup. My problem is that ClassCleanup isn't called at the end of each class, it's called only after all tests in three classes. Can I fix this issue? Thanks! [ClassInitialize] public static void SetUpBrowser(TestContext context) { pageObjectBase.SetBrowser("chrome"); pagesManager.GetPageObjectBase(); } [TestMethod] public void FindCriticalBug() { bla-bla-bla(); } [ClassCleanup] public static void CloseBrowser() { pageObjectBase.Stop(); pagesManager.GeneralClearing(); } Tests are run

run tests in mstest without compiling/building

吃可爱长大的小学妹 提交于 2019-12-05 01:56:35
is there a way? do I have to wait for building every time I start the test? I want to build from visual studio not from test thanks Any time your code changes and you run your test it is going to do a build... so technically you can run your test over and over again and they will only build the first time, but once you run your test why would you run them again without making a code change? Couple of things that I use that make your test run faster are: Check the box for "Only build startup projects and dependencies on Run", located Options->Projects and Solution->Build and Run. Learn the

How do I get a Unit Test to copy my DLLs and other files when I run a test?

浪子不回头ぞ 提交于 2019-12-05 01:24:21
I'm working on an application and I have created a number of unit tests for it. The project with the test class depends upon 3 third party DLLs. When I go to the bin\Debug folder for the test project, the Dlls are there. But when I run the test, the DLLs are not being copied into the TestResult\\Out folder. There is also a log4net.config file from another project that I would like to have copied. This one is not showing up in the test project's bin\Debug folder, so that's another issue I have to fix. How do I get these files to copy when I run the unit test? Tony We have a bin folder

Run SpecFlow tests without Visual Studio

岁酱吖の 提交于 2019-12-05 01:17:01
I would like out QA team to be able to run SpecFlow tests. I would like them to be able to change values and append more scenarios. These appended scenarios will have matching step definitions, so they only need to modify the features. The QA team does not have access to Visual Studio. Is it possible to achieve this without using Visual Studio? We are currently using MS Test but we are willing to use NUnit if that will help. Yes - there is a 'simple' way. Since SpecFlow merely generates tests from the text in the .feature files you can use the command line runner of the tool of your choice.

Why does Assert.AreEqual(1.0, double.NaN, 1.0) pass?

那年仲夏 提交于 2019-12-04 23:54:43
Short question, why does Assert.AreEqual(1.0, double.NaN, 1.0) pass? Whereas Assert.AreEqual(1.0, double.NaN) fails. Is it a bug in MSTest (Microsoft.VisualStudio.QualityTools.UnitTestFramework) or am I missing something here? Best regards, Egil. Update: Should probably add, that the reason behind my question is, that I have a bunch of unit tests that unfortunately passed due to the result of some linear algebraic matrix operation being NaN or (+/-)Infinity. The unit tests are fine, but since Assert.AreEqual on doubles with a delta will pass when actual or/and expected are NaN or Infinity, I

MSTest: how to increase test time

浪尽此生 提交于 2019-12-04 23:50:49
I have one test that needs to work more then 1 minute (VS2008, MSTest, tests are launched from the VisualStudio): const int TestTimeout = 1; [TestMethod] [Timeout(10*60*1000)] // 10 minutes public void Login_ExpirationFail_Test() { IAuthenticationParameters parameters = new AuthenticationParameters(...); LdapAuthentication auth1 = new LdapAuthentication(); IAuthenticationLoginResult res = auth1.Login(parameters); Assert.IsNotNull(res); Assert.IsFalse(string.IsNullOrEmpty(res.SessionId)); const int AdditionalMilisecodns = 400; System.Threading.Thread.Sleep((TestTimeout * 1000 +

Unit Testing for x86 LargeAddressAware compatibility

陌路散爱 提交于 2019-12-04 20:35:34
问题 For a win32 executable (x86) we can set the LargeAddressAware flag so it can access a virtual address space of 4 GB (instead of just 2 GB) when running on x64 Windows. This looks very appealing. However, there are risks involved. For example see: Drawbacks of using /LARGEADDRESSAWARE for 32 bit Windows executables? So let's go ahead and configure the system that is executing some unit tests with the system-wide registry switch AllocationPreference set to MEM_TOP_DOWN . That should do, shouldn

Problems with data driven testing in MSTest

天涯浪子 提交于 2019-12-04 20:34:13
问题 I am trying to get data driven testing to work in C# with MSTest/Selenium. Here is a sample of some of my code trying to set it up: [TestClass] public class NewTest { private ISelenium selenium; private StringBuilder verificationErrors; [DeploymentItem("GoogleTestData.xls")] [DataSource("System.Data.OleDb", "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=GoogleTestData.xls;Persist Security Info=False;Extended Properties='Excel 8.0'", "TestSearches$", DataAccessMethod.Sequential)] [TestMethod]