In this post I will describe some tips what I stole from the best software developers.
Deleting code is fine
At a point in your development of your automated tests, you will change some code. Then you can comment out the old code and write new code. You do not want to throw away old code. It is possible that you need it again.
After a while you forget about it. The result is that there is a lot of code in comments in your files.
But for that reason version control is there. Great developers do delete old code and check the code in version control without the old parts. If they want that code back, they look at it with the version control tool.
Do code reviews
Developers do code reviews on the code they write. Code reviews is not forbidden on test code you write. Test code is also code. It is not production code, but good test code improves the quality of the tests. Code reviews can
- helps to find bugs in your tests early.
- improves skills of the tester. We can learn from the developers about good coding practices.
- shares knowledge
Make it first. Make it better later.
Code can always be better. It is never finished. We can spend to much time making the code look pretty at the start. Then we find out later in the process that the code does not work.
That is why we first create code that works. Test it and make it better later. This is the test driven development approach that we know very well. We can use the same development process for our testcases. Our test cases will improve.
These are 3 little things that I stole from the best developers that helps me to create better automated test cases.