C#作为一种面向对象的高级语言,由于其搭载环境Visual Studio功能强大、可视性强、更新较快,而逐渐成为软件开发中的常用语言。由于C#语言包含类、对象、命名空间、重载、委托等多变而又复杂的形态,给C#程序的理解和测试带来了很大困难。提出一种基于Visual Studio的代码图提供的信息提取C#函数调用路径的方法。首先从代码图的XML表示——DGML的信息中获取函数、类及函数的依赖关系信息,以此为基础对源程序进行分析,提取函数调用关系树,将局部的函数调用关系树组合成全局的函数调用关系树从而得到整个软件系统的全局静态两数调用路径。实与命表明,此方法能够较为准确生成C#程序的函数调用路径,从而有助于开发人员对C#程序的理解和测试,也为测试用例的自动生成奠定了基础。
C#, as an object-oriented high-level language, with its powerful environment Visual Studio, strong visibility and update, gradually becomes a common language in the development. And due to the complixity of C# language, such as class, object, namespace, overloaded, and delegate, it is very difficuh to understand and test the C# program. This paper presents a method of extracting C# function call path based on the information extracted from the code map. The dependency information is obtained from the XML code in codemap -- DGML infoxvnation acqui- sition function, classes and function, the source code is analyzed, the function call tree is extracted, the local tunc- tion call tree is combined into a global function call tree in order to get the whole software system of the global static function call paths. Experiments show that this method can accurately generate the C# program function call path, which helps developers to understand and test the C# program, and provides a reterence for the automatic generation of test cases.