# Empirical Study of Test Case and Test Framework Presence in Public Projects on GitHub
## 3 Results
### Test Case Presence and Correlation with \"test\" in File Content  
In Figure 5, it is possible to see the number of projects containing test cases in a specific quantity. Comparing this to Figure 2 we see a very similar course as in the occurrence of the word \"test\" in _java file content_. At the same time, we can notice that there are peaks in the same places. Example tests were not excluded and were considered relevant test cases, as it is still impossible to automatically detect example test cases. In order to  
Figure 4: Correlation between the number of occurrences of the word “test” in all java files’ content and the project’s life cycle parameters.  
detect example tests, we would need to manually decide if the particular test case verifies some functionality of production code or not. This process could be automated if we could identify Unit Under Test (UUT) from a test case, because then we would be able to distinguish whether a particular UUT is in the production code or not.  
In total 51.57% of all projects included at least one test case. On the other hand, considering the results of Section 3.1 where example tests consisted of 67% for _java files content_, we can estimate that in projects with two or less test cases, only 33% of them are non-example ones. Therefore, we can calculate the percentage of projects containing at least one test case without example ones (we only considered example tests of projects with two or less test cases):  
\[P=\frac{N_{real}-N_{unreal}}{N_{all}}=\frac{3,\!239,\!308-1193,\!659*0.67}{6,\!2 80,\!818}=38.84\% \tag{2}\]  
where:  
\(N_{real}\)--number of projects containing an actual test case;  
\(N_{unreal}\)--number of projects with two or less test cases of which all are example ones;  
\(N_{all}\)--all analyzed projects.  
Of course, this is only an estimate, as even projects with a higher number of test cases can include also example ones.  
RQ 3_What is the ratio of open-source projects that contain at least one test case?_  
51.57% of 6.3 M analyzed projects included at least one test case. Considering that probably only 33% of test cases detected in projects with two detected test cases are not example ones, we estimate that only 38.84% of projects include at least one non-example test case.  
Figure 6 presents the correlation between all occurrences of the word \"test\" in _java files' content_ of a project and the detected number of actual test cases in the particular project by the proposed script. Compared to the correlation in projects with a high incidence of the word \"test\" (\(r=0.655\), see [15]), the presence of test cases is lower, reaching Pearson's correlation coefficient of \(r=0.0253\), meaning a poor correlation. Excluding forked projects, the correlation was \(r=0.0393\), so the influence of forks is minimal. The result is probably caused by the occurrence of irrelevant projects, such as testing ones, homework repositories, clones, etc.  
There is a demand to identify the relevance of projects. Some tools for this task already exist, e.g., _raper_[18], but they are very computationally intensive. Our testing [15] shows that the mentioned tool is slow to use on a large number of projects; therefore, this tool was not usable for this study.  
Figure 5: The real number of test cases in all GitHub projects with Java as a primary language.  
RQ 4_What is the general correlation between the number of occurrences of the word \"test\" in all files' content of a project and the number of actual test cases in the project?_  
There is a poor correlation due to reached Pearson's correlation coefficient of \(r=0.0253\). The negative impact of forked projects was not confirmed, so the huge decrease in correlation was probably caused by irrelevant projects.