This happened a couple of years ago, but it is still relevant because I know of at least one place where it is still happening even though Microsoft has fixed the issue that initially caused this hack to be put in place in the first place.
This happened a couple of years ago, but it is still relevant because I know of at least one place where it is still happening even though Microsoft has fixed the issue that initially caused this hack to be put in place in the first place.
This week I discovered CSS Animations. Well, I shouldn’t say I discovered it so much as I finally spent some time figuring out what it is and why I would care about it. This could make so much of what we normally do in JavaScript entirely unnecessary. So, more for my own benefit than anything else, I thought today I would just create a list of resources that are available. But first, why would you want to use CSS for animation when JavaScript could do it just as well?
I had an interesting puzzle to solve this week that I thought I would share with you in case someone else is looking for a similar solution. There was some code that I needed to test that ultimately called into the database. Since this is a UNIT test and all I was interested in testing was one specific function and the state of one specific field in another object, I had neither the need, nor the desire, to let that call to the database happen. Since MOQ is my mocking framework of choice, I wanted to mock out the database object the method was using so that it would return whatever was expected without actually calling down into the database. There were several problems. The first was that the database object is a private field in the class I was testing and it got created by the constructor. Second, the code that needed to use the database object is passing the object by reference (using the “ref” keyword) so that I could no setup my class that needed that object to just ignore it. There were some other items I needed to inject, but they were pretty straight forward.
Whoa there Dave. What are you talking about? Have you given up the fight? You who have preached the TDD religion. You who’ve struggled to get organizations to adopt naming conventions, to use version control systems and to use project management software. The same guy who has implemented continuous integration on his current project? What’s this world coming to?
As many of you know, I’ve been using Selenium to do my website testing. And, if you’ve done any testing with Selenium yourself, you know that Selenium can be even slower if you are using Selenium Grid. There are several things you might do today to achieve Selenium Performance improvements in order to increase the speed that your of your test run.
Last week I wrote a post that talked about Unit Testing and the need to make sure you are only testing one particular unit of code at a time. The post was well received. But I am surprised that no one commented on the glaring hole I left in the post.
In that post, I said:
So, one way you might go about separating your code from the data is by using dependency injection. What I’m talking about here is simple injection. No frameworks.
So, let’s say you have a class you may have called user role. Given a user id, it will return a role. How could we code this so that it doesn’t matter where the code comes from?
By declaring an interface to a user role object maybe and then passing an object of that type to the constructor.
By doing this, you can use a fake object when you are testing and a real object when you are using the system in production, but your code won’t really care which one is being used.
At some point we will need to retrieve data. But the data is always just a side effect. If you have a way of getting at the data, and you are confident it works, because that standard mechanism has been tested, then you don’t need to write test for the data access piece, you only need to write test for “given I have good data, this method will do this.”
As I reflected on the post, I realized that this may make sense to you if you are already implementing this in your code. But, if you are new to dependency injection and the concepts of loose coupling in general, this might be a foreign concept for you.
At the very least, I realize now that it could be flushed out a bit more.
So, here we go.
One of the problems I had when I started to learn unit testing, and a concept that seems to be hard to grasp as I teach others about unit testing, is this concept of testing just a unit. What is a unit after all?
One of the design principles in software development is to only write what you need today. This has taken on the moniker of YAGNI (You Aren’t Going To Need It).
The question is, in what ways do we violate this principle?
What could possibly be confusing about JavaScript Booleans you ask?
Well, here’s several logical statements written in JavaScript. Do you know what each does?
Running Selenium in parallel from .NET seems to be a problem because, as of the time of this writing, I’ve yet to find a viable way of running selenium test on multiple browsers using Selenium Grid. This doesn’t mean that there aren’t a few articles out there that have some kind of solution. But they’ve never satisfied me as something that I could easily plug into my already created test. While my preferred testing tools are NUnit and SpecFlow, the method I am about to propose should work with any existing test harness you might want to use. The only prerequisite is that you are using Page Models to wrap your access to any particular web page. This article assumes that you already: