Follow

Recruiter 2.0 Unit Tests Guide

1. Clone cstools 

a. Create folder where project will be located, e.g. c:/cstools_unit

b. Open cmd and go to the folder c:/cstools_unit 

c. Clone cstools repository e.g."git clone https://palekseev@bitbucket.org/gsamaritan/cstools.git"

2. Install required tools

a) NodeJs. Find latest nodejs here https://nodejs.org/en/. Add “C:\Users\[USER]\AppData\Roaming\npm;C:\Program Files\nodejs\;” to the PATH variable, where [USER] your current user in windows system

b) Karma. In the cstools project folder open test_suites/karma/install/ folder and execute karma-install.cmd

c) Jasmine. In the cstools project folder open test_suites/karma/install/ folder and execute jasmine-install.cmd

3. Configure

a) Open cstools project folder
b) Open test_suites/karma folder
c) Open karma.conf.js
files – files that should be loaded for testing and coverage statistic


exclude – files that should not be loaded for testing and coverage report


preprocessors – list of files from b. that should be included for coverage report

4. Create unit test 

a) testcases folder – this folder created for unit tests, if you want to add new test please add new file. Please use testcases\sDs.test.js as example (please see comments in file for better understanding)


b) All files that located in this folder will be executed automatically 

5. Run tests on local computer

a. Open cmd and chdir c:\cstools_unit\test_suites\karma

b. Run via type "karma start" and press enter

c. Find results in the c:\results\ folder 

The c:\results\unit folder contains testing results 

The c:\results\coverage folder contains results of coverage statistic

 6. Add to Continuous Integration

a. After checking test locally push it to git.

b. If conf.js file has been changed, please push only files,exclude,preprocessors variables changes.

c. Verify all works as expected, via check your test executed successfully via click over "Jasmine Report" or "Coverage Report" links on the Jenkins page http://jenkins.samaritan.com:8080/job/RS15%20deploy%20and%20test%20CStoolsDev/

0.png

 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk