Transcripted Summary

If we run many tests, the view on the left side might be a bit overwhelming.

We might have way too many test results here and it might be really difficult to sort through them to see which tests have passed and which tests have failed.


We could just filter out some of these results.

For example, if I hover these 2 icons, currently, the Show Passed button is enabled and the Show Ignored button is also enabled. This means that all of the test results are shown: the passed, the failed, and the ignored tests.



If I don't want to show all of these, let's say I'm only interested in those which are not passed, which means I have a list of all of the failures, all of the things that I need to address, then I can just unclick the Show Passed button.

As you can see, the list has narrowed down, so I currently do not see my passed tests.



Also, if I don't want to see the ignored tests for whatever reason, maybe they are ignored for some purpose, then I can just click the Show Ignored button and then I won't see these either.

So currently, I'm only left with those tests that need to be addressed.

I can, of course, click the Show Passed button for them to be shown again. And then I can click on the Show Ignored button in order to see all of the tests, whether they were failed or passed.


We can also sort the way they are displayed on the left-hand side by.

For example, sorting alphabetically or sorting by the duration, which, as I've mentioned, you can see on the right side, next to each of them.



The duration is expressed for the entire package and then for each item by itself. This is the class, and these are the two test methods.


We could also collapse this view.

If we have a lot of tests that we've browsed through, we can just choose to collapse just to see the package level.



And then if we want to open another test result, we can just expand these manually and we can just expand that particular class we're interested in so as to see as much relevant information on the site as possible.

So, this is the left-hand menu where you can see all of your tests that have run with all of their statuses.

We also have 2 important buttons here, which are the Rerun and the Rerun Failed Tests.



  • If we want to rerun all of these tests, we can just click the first button.

  • If we only want to rerun those tests that have failed, we can click on the second button.

Let's see what this looks like.

I will just click the Rerun button, which means I want to rerun the entire package.

Of course, the Selenium tests open and they run. So, they opened the page and the tests have finished again. As you can see, the initial set of results was now overridden by the new test run. Again, I have 1 passed test here.

If I want to click the second button, the Rerun Failed Tests, I will not rerun the second assertion test anymore because this one was successful when I initially ran it.

I will just click the _Rerun Failed Tests _button, and now let's see how many tests we have.

Currently, we only have 3 failed tests, so we only rerun 3 tests — the test which was ignored was not rerun.



Previously we had seen that we had 4 failed tests, that included the ignored test also. So, at the rerun, we did not rerun the ignored test.

We only at reran those tests, which had assertions that failed.

The other test that was initially ignored was actually a test which failed before running even a single assertion. That is because its setup was missing something. And I will address that, and we will see again, when we run the test, what happened there.

Currently, just remember that if you rerun failed tests, you will only rerun those tests who failed because of their assertion failures.

So, all of these tests had some assertions whose expected and actual values were not equal.



Quiz

The quiz for this chapter can be found in section 7.4