Posts

Showing posts from March, 2017

Java Unit testing using JUnit @RunWith(Suite.class)

As developers we should start writing unit test cases, to be sure the unit of codes we have written works fine. Along with unit testing we can write functional test cases to be ensure our functionality works as expected. In this blog post i'm planing to explain how i used JUnit and selenium for an external OAuth login module. In my module I needed to support set of external account from different OAuth providers, such as google, facebook, microsoft etc ... This module is responsible for provide a valid access token for different provider from an API exposed to external systems. There are 3 steps in this module Add External Account. Get Tokens. Delete External Accounts. I wanted my unit and functional testing to run in the above mentioned sequence. So I used JUnit  Suit API , which executed my test classes in given sequence. To order the test methods I used  FixMethodOrder API  (This is available from JUnit 4.11). I used gradle as the build system. I'm using 3 classes