The culture of continuous code testing is at the heart of what we bake at upskillable, no matter whether the code is written for any application or infrastructure. While starting a new project, we don’t feel certain enough unless we implement testing in our CI process. Here we have no excuses of taking the endeavor to write project test codes at some other time. Keeping this in mind, we decided to implement continuous code analysis and code coverage for covering our unit test cases with Codacy.
“Why Codacy?” you might ask. Well, at present we are using the free service provided by Codacy and the reasons for choosing are:
- Codacy comes with a very user friendly GUI with excellent code coverage & code issue reporting per commit.
- It is easy to configure and fits fine in CI process.
- Excellent slack notification for creating/solving issues against test standard tagged with committer name. This helps us to find who is doing what up to which context.
- Good security compliance with automatic SSH key rotation for secure code management.
Code Analysis & Continuous Integration:
I will explain how I setup code coverage in continuous integration (CI) process and upload coverage report in Codacy. We are using AWS Codebuild for build/test purpose and I hope this time I don’t have to write about CI. Let’s start with simple configuration snippets:
While configuring any project in Codacy, you will be provided a secret project token which is needed by Codacy to authenticate with any client. Using AWS parameter store and AWS KMS, we have encrypted the secret token in AWS which will be later retrieved by build slaves. Since we are using AWS Codebuild, we speak to build environment through `buildspec.yml` which we put at the root of our source code. In the above snippet, we have declared the variable in `buildspec.yml` to receive secret project token value that we configured earlier using parameter store.
Next, we are downloading Codacy reporter client in the build slave before actual build starts.
Coverage Report with Codacy:
What would be the role of code analysis without implementing code coverage? Huh, you might be thinking about that. It’s been enough on code analysis and continuous integration above. Code coverage is no less important than CI because without proper code coverage we would never know how much of code is being tested.
Well, the above image indicates the code coverage status at upskillable. For getting code coverage report in Codacy, all you need is to upload coverage report for each build which we already discussed earlier. We are still evolving and on rapid development.
Code analysis and code coverage helps business to achieve faster feedback on company goals and changes in the tests & code being written. And definitely, we are constantly adopting and improving to achieve higher benchmark of code quality, customer satisfaction, revenue and productivity.
About upskillable: upskillable is a pre-employment assessment solution with an integrated jobs portal built by a team of experts with years of experience working with great organizations. upskillable’s integrated job board, multi dimensional psychometric and skills assessment engine, and applicant tracking system (ATS) accelerate the hiring process by leveraging automated intelligence (Ai). Our pre-employment assessment solution is not only easy to use, but also curates instantly the top candidates making the hard work of hiring the right person easy.