Step‑by‑Step Guide to Set Up and Run FunTester for Java/Groovy
This tutorial walks you through installing Groovy, configuring environment variables, cloning the FunTester repository, building with Gradle, and running a simple hello‑world test case, while also detailing the framework's project structure and essential code snippets.
After a long wait, this tutorial finally covers the FunTester testing framework, focusing on Java and Groovy support.
Groovy Environment Setup
Although optional, installing Groovy 3.0.8 is recommended to avoid missing dependencies when packaging JAR files.
Download the Groovy 3.0.8 zip package.
Extract it to a convenient location.
Configure the environment variables.
Run groovy -v to verify the installation.
If the download is slow or unavailable, request a network‑drive link (71 MB) in the comments.
Groovy also requires JAVA_HOME to be set in the environment variables; adjust the configuration according to any error messages you encounter.
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_281.jdk/Contents/Home
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
GROOVY_HOME=/Users/oker/Library/groovy-3.0.8
GRADLE_HOME=/Users/oker/Library/gradle-6.8
PATH=$JAVA_HOME/bin:$PATH:
PATH=$GRADLE_HOME/bin:$PATH:
PATH=/Users/oker/Library/k6/0.31.1/bin:$PATH:
PATH=$GROOVY_HOME/bin:$PATH:
export JAVA_HOME
export CLASSPATH
export PATHCloning the FunTester Project
Use one of the following Gitee URLs (choose any; if one fails, try the other). The project’s active branch is oker .
[email protected]:fanapi/tester.git
https://gitee.com/fanapi/tester.git
FunTester builds with Gradle; the tutorial was tested with Gradle 6.8. Newer IntelliJ versions may download a default Gradle version automatically.
Running a Hello‑World Test
Create a Groovy (or Java) test class with a main method as shown below, then execute it.
public static void main(String[] args) {
3.times {
output(it)
}
}If the console displays the following lines, the first chapter is complete:
INFO-> 当前用户:oker,工作目录:/Users/oker/IdeaProjects/funtester/,系统编码格式:UTF-8,系统Mac OS X版本:10.16
INFO-> 0
INFO-> 1
INFO-> 2
Process finished with exit code 0Project Structure
The FunTester framework’s directory layout is illustrated below (packages not used in the oker branch are commented out).
base(基础类)
bean(Java bean)
constaint(抽象类)
exception(自定义异常)
interfaces(接口集合)
config(配置和常量)
db(数据库封装)
mongodb(MongoDB封装,已注释)
mysql(mysql封装,已注释)
redis(Redis封装,已注释)
dubbo(dubbo封装)
frame(框架核心代码)
execute(执行工具类)
thread(性能测试多线程类)
JsonVerify(JSON验证封装,基于JsonPath)
Output(输出功能封装)
ResponseVerify(响应验证封装,即将放弃)
Save(数据存储方法封装)
SourceCode(常用方法封装)
httpclient(HTTP协议封装)
ClientManage(HTTP客户端封装)
FunLibrary(HTTP请求响应封装)
FunRequest(HTTP相关封装方法)
GCThread(资源回收多线程类)
socket(socket协议封装)
utils(工具类)Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
