Writing effective tests
We will learn how to implement tests by writing tests for the link
and the import
commands.
The first thing we need to do is to add a test class for each command. We already have the folder structure in place, so let’s add the test classes. As I mentioned earlier, I find it useful to name my test classes after the actual classes with an added suffix of Tests
. So, our test classes will be named LinkCommandTests
and ImportCommandTests
, respectively.
Now, let me introduce you to the best practices of structuring a test class and its test methods (yes, we will talk about structure once again! 😊):
- Using MS Test, a test class is decorated with the
[TestClass]
attribute. If you don’t provide this attribute, the class will not be considered a test class and the test methods it contains will not be run. - A test class usually consists of multiple test methods. The name of a test method should convey its intent. This is important...