栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

JunitG

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

JunitG

提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档

文章目录

前言一、JunitG是什么?二、JunitG的配置

1.下载JunitG2.生成测试类2、JunitG配置JunitG Junit4配置 总结


前言

提示:这里可以添加本文要记录的大概内容:

JunitG的学习


提示:以下是本篇文章正文内容,下面案例可供参考

一、JunitG是什么?

JunitG是一种测试自动生成生成框架。

二、JunitG的配置 1.下载JunitG
IDEA插件(plugins)中搜索JunitGenerator下载安装

2.生成测试类

可以使用右键菜单、快捷键(Alt + Enter 或 Ctrl + Shift + T)

生成代码如下:

2、JunitG配置

Output Path 设置 S O U R C E P A T H / . . / . . / t e s t / j a v a / {SOURCEPATH}/../../test/java/ SOURCEPATH/../../test/java/{PACKAGE}/${FILENAME}

JunitG Junit4配置
######################################################################################## 
## 
## Available variables: 
##         $entryList.methodList - List of method composites 
##         $entryList.privateMethodList - List of private method composites 
##         $entryList.fieldList - ArrayList of class scope field names 
##         $entryList.className - class name 
##         $entryList.packageName - package name 
##         $today - Todays date in MM/dd/yyyy format 
## 
##            MethodComposite variables: 
##                $method.name - Method Name 
##                $method.signature - Full method signature in String form 
##                $method.reflectionCode - list of strings representing commented out reflection code to access method (Private Methods) 
##                $method.paramNames - List of Strings representing the method's parameters' names 
##                $method.paramClasses - List of Strings representing the method's parameters' classes 
## 
## You can configure the output class name using "testClass" variable below. 
## Here are some examples: 
## Test${entry.ClassName} - will produce TestSomeClass 
## ${entry.className}Test - will produce SomeClassTest 
## 
######################################################################################## 
## 
#macro (cap $strIn)$strIn.valueOf($strIn.charAt(0)).toUpperCase()$strIn.substring(1)#end 
## Iterate through the list and generate testcase for every entry. 
#foreach ($entry in $entryList) 
#set( $testClass="${entry.className}Test") 
## 
package $entry.packageName; 

import org.junit.Test; 
import org.junit.Before; 
import org.junit.After; 

 
public class $testClass { 

@Before
public void before() throws Exception { 
} 

@After
public void after() throws Exception { 
} 

#foreach($method in $entry.methodList) 
 
@Test
public void test#cap(${method.name})() throws Exception { 
//TODO: Test goes here... 
} 

#end 

#foreach($method in $entry.privateMethodList) 
 
@Test
public void test#cap(${method.name})() throws Exception { 
//TODO: Test goes here... 
#foreach($string in $method.reflectionCode) 
$string 
#end 
} 

#end 
} 
#end
总结

提示:这里对文章进行总结:
例如:以上就是今天要讲的内容,本文仅仅简单介绍了pandas的使用,而pandas提供了大量能使我们快速便捷地处理数据的函数和方法。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/781783.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号