Info: These testcases are critical functionality.
Judging by the above statement, I'd say you need to have both unit tests and UI automated tests (or integration as well depending on the architecture layer and systems integrated).
However, there are pros and cons on using both (that mostly depends on the organization, engineer in charge of creating one type or all of them).
For unit tests I'd go for pros with:
- extremely fast to run
- easy to create (taking for granted that the code is of high quality standards and unit testing "friendly")
- better understanding of the code (by unit testing your code you may reveal cases you did not anticipate and will help you define the a better behavior of the code)
- can catch high severity or show stopper bugs
As for cons, I'd go with:
- increased overhead of amount of code to write. Having in mind that every class and method in your code will need to be tested, this can impact your ability as a developer to ship new features
- one of the most important aspects, you cannot tests your UI (while you can unit test your JS for instance, it still doesn't assure you that you're on the safe side, especially for critical systems)
As for the UI tests, for Pros:
- very good for validating user journeys and flows on the UI level
- they can cover end-to-end flows that communicate with 3rd party systems
- like unit tests, can catch high severity or show stopper bugs
- may be able to check UI functionality where it is not always possible to test otherwise
As for cons:
- UI tests can be very brittle (will fail due to UI changes even though
functionality hasn't changed. E.g. identifiers like ID have been
changed on your page)
- the execution will be considerably slow compared to unit tests as you have to wait for the system to launch and for connections with 3rd party system that can take a long time
- you will need to depend on a 3rd party tool (open source or paid)
In conclusion, I'd go with unit tests for the critical core functionality and UI tests that will also cover that critical functionality from the UI side (or end-user point of view).