reset password
Author Message
bseemscs
Posts: 26
Posted 23:33 Jul 15, 2015 |

Can there be more than one assert in a test method? I am wondering if each assert can check a condition and then all assert must pass for that test to pass or does the entire check have to be included in one assert?

cysun
Posts: 2935
Posted 08:32 Jul 16, 2015 |

You can have more than one assert in a test method. "Assert" checks a boolean condition - if it's true, nothing happens, and if it's false, assert raises an exception and the test method is considered failed. So it basically works as you would expect: all asserts need to pass in order for a test method to pass, and one failed assert will cause the test method to fail.