"value":"\n <p>Similar to \"a method should only have one return statement\", I've seen similar advice when working with tests: \"Tests should only have a single assertion\".<\/p>\n\n<p>I don't think this is true, and in my experience, you need multiple assertions to have a thorough test.<\/p>\n\n<p>And, whilst similar assertions add some duplication, they can make the intent clearer and give better error messages.<\/p>\n\n<p>Instead, I focus on one test case per test.<\/p>\n\n<p>If I'm testing the following:<\/p>\n\n<ul>\n<li>A blog page exists.<\/li>\n<li>Only post nodes are visible.<\/li>\n<li>Only published posts are visible,<\/li>\n<li>Posts are returned in a specified order.<\/li>\n<\/ul>\n\n<p>These will be split into separate tests - making it easier to read and maintain the code and have faster execution times by running only the tests I want with the minimum amount of code in each - regardless of how many assertions are in each.<\/p>\n\n ",
"format":"full_html",
"processed":"\n <p>Similar to \"a method should only have one return statement\", I've seen similar advice when working with tests: \"Tests should only have a single assertion\".<\/p>\n\n<p>I don't think this is true, and in my experience, you need multiple assertions to have a thorough test.<\/p>\n\n<p>And, whilst similar assertions add some duplication, they can make the intent clearer and give better error messages.<\/p>\n\n<p>Instead, I focus on one test case per test.<\/p>\n\n<p>If I'm testing the following:<\/p>\n\n<ul>\n<li>A blog page exists.<\/li>\n<li>Only post nodes are visible.<\/li>\n<li>Only published posts are visible,<\/li>\n<li>Posts are returned in a specified order.<\/li>\n<\/ul>\n\n<p>These will be split into separate tests - making it easier to read and maintain the code and have faster execution times by running only the tests I want with the minimum amount of code in each - regardless of how many assertions are in each.<\/p>\n\n ",