12
gitpush
7y

If only they allow us to write unit test at work, its not that It is forbidden but we are not given time to do so :\

Done my test on my side project and now I can happily move to the next step.

Though I'd be happy if someone answers this:
1. When I have to execute functions by order, do I write all their code in one single function and divide them into regions (speaking of C# #reagion)

OR

2. I keep them split and implement the order attribute for XUnit?

My test case is basically just to make sure CRUD methods inside my repositories are working as expected, noting complex

Comments
  • 2
    Personally I hate c# regions. If a method needs to be split then split it into functions, if your test is that big maybe it should be several tests.
  • 2
    You can't afford not to write tests! A boss telling you not to write tests is a boss telling you not to use syntax highlighting -- it's none of their business. Write those tests!
  • 0
    @spacem for now it isn't big, I'm just inserting for example then checking result. The test case that I have it's result attached in this rant is about 90 lines, I guess it is still a tiny case lol

    @Polarina I don't have time, if I'll be going to write them I won't leave office, and when I ask for time to do it, silence is all I get :/
  • 1
    @gitpush Don't think of tests as an optional supplement that can be tacked on afterwards.

    Try taking a stab at practicing test-drive development (TDD). While you may feel that TDD slows you down at first, that will quickly change as you get used to these new practices. Before you'll know it, writing code with tests will become both easier and faster than without tests.

    If you're into books, I recommend reading Working Effectively with Legacy Code by Michael Feathers.
  • 0
    @Polarina thanks for your suggestion, I'll look into that for my personal projects but for working truly doubt I'll be able to it, for example today I found out that release is after 10 days I'm still behind in iOS app features but Android app is right on schedule 🙄😒
    Imagine how it will be if yet I have to write tests, I don't think I'll ever get to sleep ...
Add Comment