tdd

How to exclude Projects with names ending in “.Test” from my code coverage analysis in VS2012 Unit Tests

有些话、适合烂在心里 提交于 2019-12-18 11:46:47
问题 My solution is set up with projects called "ProjectName" with "ProjectName".Tests containing my unit tests. I'd like to exclude the test projects from the code coverage analysis under VS 2012 (MS Test) and have successfully managed to do this by adding the ExcludeFromCodeCoverage attribute to each test class as described here. As the number of tests classes is growing it would be nice to exclude the entire Test assemblies. I want to use the .runsettings file also described in that MSDN link

Why is there no test instrumentation for BroadcastReceiver?

痴心易碎 提交于 2019-12-18 11:39:43
问题 Maybe I'm missing something. I want to write test cases for a BroadcastReceiver; specifically, it is for receiving the BOOT_COMPLETED event and setting an alarm for another receiver to handle later; it doesn't seem to be setting it properly, but the point is that I have no obvious way to test it. I can't exactly attach a debugger and wait for BOOT_COMPLETED, and I can't send a fake BOOT_COMPLETED broadcast. Why are there instrumentation classes for Activity, Service, and Provider, but not

What is the expected syntax for checking exception messages in MiniTest's assert_raises/must_raise?

萝らか妹 提交于 2019-12-18 11:14:36
问题 What is the expected syntax for checking exception messages in MiniTest's assert_raises / must_raise ? I'm trying to make an assertion something like the following, where "Foo" is the expected error message: proc { bar.do_it }.must_raise RuntimeError.new("Foo") 回答1: You can use the assert_raises assertion, or the must_raise expectation. it "must raise" do assert_raises RuntimeError do bar.do_it end -> { bar.do_it }.must_raise RuntimeError lambda { bar.do_it }.must_raise RuntimeError proc {

How do I convince programmers in my team to do TDD? [closed]

允我心安 提交于 2019-12-18 11:10:50
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . I am aware of this question: https://stackoverflow.com/questions/428691/how-to-encourage-implementation-of-tdd In my team, we write a

How to learn TDD with Ruby?

ぃ、小莉子 提交于 2019-12-18 10:34:07
问题 I have been using ruby exclusively for about a month and I really love it. However, I am having an incredibly hard time using, or even learning TDD. My brain just doesn't function that way... I really, really want to learn TDD but to be honest I am a bit confused. All the articles that I find when Googling around are mostly specific to Rails, which is not interesting to me because I want to learn how to do efficient testing for any ruby application, from the simple one-file script to the

How can I unit test my ASP.NET MVC controller that uses FormsAuthentication?

自古美人都是妖i 提交于 2019-12-18 10:27:28
问题 I'm working with a ASP.NET MVC solution in a test driven manner and I want to login a user to my application using forms authentication. The code I would like to end up with in the controller looks something like this: FormsAuthentication.SetAuthCookie(userName, false); My question is how do I write a test to justify this code? Is there a way to check that the SetAuthCookie method was called with the correct parameters? Is there any way of injecting a fake/mock FormsAuthentication? 回答1: I

How can I unit test my ASP.NET MVC controller that uses FormsAuthentication?

你离开我真会死。 提交于 2019-12-18 10:27:05
问题 I'm working with a ASP.NET MVC solution in a test driven manner and I want to login a user to my application using forms authentication. The code I would like to end up with in the controller looks something like this: FormsAuthentication.SetAuthCookie(userName, false); My question is how do I write a test to justify this code? Is there a way to check that the SetAuthCookie method was called with the correct parameters? Is there any way of injecting a fake/mock FormsAuthentication? 回答1: I

Books that will cover TDD, DDD and Design Patterns in .NET

岁酱吖の 提交于 2019-12-18 10:19:30
问题 I would like to get book(s) that will really give me a complete view of modern ASP.NET development using C#, TDD, ASP.NET MVC, DDD and Design Patterns such as the Repository pattern. I'm very competent with C# and ASP.NET MVC, but want to fill in the gaps. If you've had a good experience with a book or two that covers these topics could you please share them? 回答1: I'm currently interested in how to architecture good .NET applications and I'm reading or have currently read some of the

How to write good Unit Tests? [closed]

纵饮孤独 提交于 2019-12-18 10:07:16
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . Could anyone suggest books or materials to learn unit test? Some people consider codes without unit tests as legacy codes. Nowadays, Test Driven Development is the approach for managing big software projects with ease. I like C++ a lot, I learnt it on my own without any formal education. I never looked into Unit

Unit Testing Example with OCUnit

﹥>﹥吖頭↗ 提交于 2019-12-18 09:54:49
问题 I'm really struggling to understand unit testing. I do understand the importance of TDD, but all the examples of unit testing I read about seem to be extremely simple and trivial. For example, testing to make sure a property is set or if memory is allocated to an array. Why? If I code out ..alloc] init] , do I really need to make sure it works? I'm new to development so I'm sure I'm missing something here, especially with all the craze surrounding TDD. I think my main issue is I can't find