Home » Posts tagged "bdd"

Using JavaScript to Drive Selenium Tests

I’ve written about using Selenium to test web applications before.  But all of those articles have assumed you are using C#.  I’ve realized that Selenium has multiple language bindings which allow me to use any language I want but C# just seemed easier at the time.  But, now I’m in an environment that doesn’t use .NET at all.  They use Java.  I know Java, but I choose not to use it and instead my focus at this shop is all JavaScript.  Which means, if I want to write Selenium tests to verify my work, I need to write my tests in JavaScript.  But Using JavaScript to Drive Selenium is, in my opinion what everyone should be doing.  At least everyone who is writing most of their web application using client side code.

Think about it, the primary language you wrote the client side with is JavaScript, and yet you are going to write your tests using C#, Java, PHP… when you could be writing the tests using JavaScript.  The same language you used to write the bulk of your application.  Further, when you write your tests using C# or Java, you’ll probably either write the tests using a unit testing framework (MSTest, NUnit, JUnit) or you’ll use some sort of BDD adapter like SpecFlow to coerce the unit testing framework into the behavioral pattern you need.

image

Continue reading “Using JavaScript to Drive Selenium Tests”

Setting up SpecFlow

I’ve been asked to train a group of developers in the use of SpecFlow so that they can use it to write Selenium Tests.  So, in an attempt to “kill two birds with one stone” I thought today’s post would cover how to get the SpecFlow environment setup.  Not only will it help me prepare for the training session I will be leading, but it will help me when I need to set this up the next time because it tends to be a bit confusing when you setup a new project.  You’ll see why in a bit.

Continue reading “Setting up SpecFlow”

Why Johnny Can’t do Test Driven Development

ppl-kid-05Last week we looked at a few excuses developers give for not testing their code as they develop it (Excuses For Not Testing).  We finished that by mentioning that most of the code you write simply isn’t testable.  You can’t practice Test Driven Development on something that isn’t testable in the first place.

And there, folks, is why Johnny can’t test.

Continue reading “Why Johnny Can’t do Test Driven Development”

Excuses For Not Testing

ppl-kid-044As I started my own journey into unit testing, I slowly began to realize that it was really easy to come up with reasons to NOT test my code as I was writing it, even once I understood what that was supposed to look like. The reason I think most programmers don’t unit test code, once they understand what it is they are supposed to be doing is that they don’t feel like they have permission.

To this I also answer, “How much permission do you need?”

Continue reading “Excuses For Not Testing”