Automated code coverage and cyclomatic complexity analyses


Automated code coverage and cyclomatic complexity analyses

Part A: Installing Java SE Development Kit (JDK)

1. If you don't have any Java version installed on your computer, install Java SE Development Kit (JDK).

4. Note: if you have one or multiple java versions on your machine already, it may be advisable to install a new operating system virtual machine. Then install the new version of JDK on the OS virtual machine.

Part B: Obtaining C and C++ code counter

Part C: Generating software metrics and cyclomatic complexity

Find your assigned test application in Table 1 at the end of this document.

Change directory to the "src" folder that contains the java source files of your assigned java test application. note: for java2d, the java source files are in .\java2d\src\java2d folder.

First display date by typing command "date" in the command line.

Then display time by typing command "time" in the command line.

To generate software metrics of your assigned java test application, use the command "c:\{your cccc directory}\cccc.exe *.java".

A .cccc folder in {your assigned java test application directory}\src is created that contains the test results. View the report in the primary html output such as .cccc\cccc.html.

Part D: Obtaining EMMA

There is also an emma plug-in for Eclipse, if you are familiar with Eclipse. or do the following.

a. From your Eclipse menu select Help → Eclipse Marketplace. Search for eclEmma. Click install for "EclEmma Java Code Coverage". Follow the steps in the installation wizard.

b. Or From your Eclipse menu select Help → Install New Software... In the Install dialog enter https://update.eclemma.org/ at the Work with field. Check the latest EclEmma version and click Next. Follow the steps in the installation wizard.

Part E: Homework - Generating a code coverage report.

1. Find your assigned test application in Table 1 at the end of this document.

2. If you have Emma plug-in installed with Eclipse, try to generate coverage report

3. Otherwise, create a "test" folder under c:\ dirve such as c:\test.

4. Copy the folder containing jar file and src folder of your assigned test application to c:\test folder. note: use java.exe and test jar file from the same jdk package.

5. To run EMMA in a command window, first open a DOS command window.

6. Then display date by typing command "date" in the command line.

7. Then display time by typing command "time" in the command line.

8. Then set classpath by typing "set classpath=%CLASSPATH%;{your emma.jar directory}/emma.jar".

Note1: you need to make sure "java" command works first. Classpath should point to ".;javahome\jdk\bin" Note2: you may also do a "echo %classpath%" command to see if it contains ".;javahome\jdk\bin;{your emma.jar directory}/emma.jar"

9. Change directory to the folder that contains your assigned java test application. Note: use command "cd" to change directory, e.g., cd c:\test.

10. Use the command "java emmarun -r html -jar YourTestApp.jar" to generate a code coverage report.

11. Try to do or test a few things with the test application. Then exit application.

12. View code coverage report in html format by opening {your assigned java test application directory}\coverage\index.html. The percentage of code coverage depends on how much you do with the application.

13. Take screenshots of your work that contains DOS command window that shows classpath and execution log as well as the coverage report.

14. Check to see if the extent of testing in step 10 correlates with the percentage of code coverage in the report.

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: Automated code coverage and cyclomatic complexity analyses
Reference No:- TGS0950269

Expected delivery within 24 Hours