自动化测试,首先想到的就是fitnesse。但是毕竟fitnesse功能优先,在自动化测试中,会遇到瓶颈。这个时候就需要对fitnesse进行二次开发。fitnesse不但有可以直接部署运行的jar包,在github上也可以下载到源代码。
源码是用gradle工具进行构建的。
Github下载地址:https://github.com/unclebob/fitnesse.git

一、Gradle安装

我使用的是IDEA 2017,对应的gradle版本是3.5,安装过程很简单,网上一查便知。完成后需要配置系统环境变量:GRADLE_HOME、GRADLE_USER_HOME以及path变量。


Path变量

打开cmd命令行,然后运行gradle -v,会显示gradle的信息,则表示安装成功。

二、IDEA导入fitnesse项目

打开idea,导入项目后,需要配置很多信息。gradle目录下的gradle-wrapper.properties中改成版本3.5

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-3.5-bin.zip
zipStorePath=wrapper/dists

build.gradle文件是利用gradle进行项目构建的核心配置文件,以下是经过我修改后可行的配置。

buildscript {repositories {mavenCentral()}dependencies {classpath 'info.solidsoft.gradle.pitest:gradle-pitest-plugin:1.1.9'}
}plugins {id 'java'id "maven-publish"id "com.jfrog.bintray" version "1.8.4"id "com.github.ben-manes.versions" version "0.20.0"
}apply plugin: "info.solidsoft.pitest"
version = new Date().format('yyyyMMdd')
println "Building FitNesse v${project.version}..."repositories {mavenCentral()
}configurations {lesscssoptionalcompile {transitive = falseextendsFrom optional}runtime {transitive = false}
}sourceSets {main {java.srcDir 'src'resources.srcDir 'src'output.resourcesDir output.classesDir}test {java.srcDir 'test'}
}sourceCompatibility = '1.8'
targetCompatibility = '1.8'dependencies {compile "org.htmlparser:htmlparser:2.1"compile "org.htmlparser:htmllexer:2.1"compile ("org.apache.velocity:velocity-engine-core:2.0") {exclude group:"org.apache.commons", module: "commons-lang3"exclude group: 'org.slf4j', module: 'slf4j-api'}compile "org.apache.commons:commons-lang3:3.8.1"compile "org.slf4j:slf4j-api:1.7.25"compile "org.slf4j:slf4j-jdk14:1.7.25"compile "org.json:json:20180813"compile "com.googlecode.java-diff-utils:diffutils:1.3.0"optional "org.apache.ant:ant:1.10.5"optional "junit:junit:4.12"testCompile "junit:junit:4.12"testCompile "org.mockito:mockito-core:2.23.4"testCompile "org.hamcrest:hamcrest-all:1.3"testCompile "net.javacrumbs.json-unit:json-unit:2.2.0"compileOnly files('lib/joda-time-2.3.jar')lesscss "org.mozilla:rhino:1.7.10"
}task fitNesseVersion {def versionFile = new File("${sourceSets.main.output.resourcesDir}/META-INF/FitNesseVersion.txt")versionFile.parentFile.mkdirs()versionFile.text="v${version}"
}task compileBootstrap(type: LessCompiler) {inputDir file('src/fitnesse/resources/bootstrap/less')mainLessFile = 'fitnesse-bootstrap.less'cssFile file("${sourceSets.main.output.resourcesDir}/fitnesse/resources/bootstrap/css/fitnesse-bootstrap.css")classpath configurations.lesscss
}task createUpdateLists(type: WikiFileListBuilderTask) {outputDirectory = "${sourceSets.main.output.resourcesDir}/Resources"files = {// Make sure only files in version control are added to the default wiki contents"git ls-files FitNesseRoot".execute().text.readLines()}doNotReplaceFiles = ["FitNesseRoot/content.txt","FitNesseRoot/properties.xml","FitNesseRoot/FrontPage/content.txt","FitNesseRoot/FrontPage/properties.xml","FitNesseRoot/PageHeader/content.txt","FitNesseRoot/PageHeader/properties.xml","FitNesseRoot/PlugIns/content.txt","FitNesseRoot/PlugIns/properties.xml","FitNesseRoot/PageFooter/content.txt","FitNesseRoot/PageFooter/properties.xml","FitNesseRoot/TemplateLibrary/content.txt","FitNesseRoot/TemplateLibrary/properties.xml","FitNesseRoot/TemplateLibrary/StaticPage/content.txt","FitNesseRoot/TemplateLibrary/StaticPage/properties.xml","FitNesseRoot/TemplateLibrary/SuitePage/content.txt","FitNesseRoot/TemplateLibrary/SuitePage/properties.xml","FitNesseRoot/TemplateLibrary/TestPage/content.txt","FitNesseRoot/TemplateLibrary/TestPage/properties.xml" ]
}processResources.dependsOn "fitNesseVersion", "compileBootstrap", "createUpdateLists"task copyRuntimeLibs(type: Copy) {into "lib"from configurations.runtime
}test {dependsOn copyRuntimeLibsmaxParallelForks 1
}pitest {targetClasses = ['fit.*', 'fitnesse.*']pitestVersion = "1.4.3"threads = 1 // We can not deal with parallel execution yetoutputFormats = ['XML', 'HTML']
}task run(type: JavaExec) {dependsOn classes, copyRuntimeLibsclasspath = sourceSets.main.runtimeClasspathmain "fitnesseMain.FitNesseMain"args "-p", "8001", "-e", "0"
}jar {dependsOn createUpdateListsfrom {//添加依懒到打包文件configurations.runtime.collect{zipTree(it)}}into('Resources') {from('.') {include createUpdateLists.wikiFiles as String[]}}duplicatesStrategy = 'exclude'manifest {attributes("Main-Class": "fitnesseMain.FitNesseMain","Implementation-Version": version)}
}task standaloneJar(type: Jar) {baseName = 'fitnesse'classifier = 'standalone'from {(configurations.compile - configurations.optional).collect { zipTree(it) }} {exclude 'META-INF/**'}from jar.outputs.files.collect {zipTree(it)}manifest {attributes("Main-Class": "fitnesseMain.FitNesseMain","Implementation-Version": version)}
}task slimJar(type: Jar) {baseName = 'fitnesse'classifier = 'slim'from { jar.outputs.files.collect { zipTree(it) } }{include 'fitnesse/html/*.class'include 'fitnesse/slim/**/*.class'include 'fitnesse/socketservice/*.class'include 'util/*.class'include 'fitnesse/util/StringUtils.class'}manifest {attributes("Implementation-Version": version)}
}task acceptanceTest(type: JavaExec) {mustRunAfter testonlyIf { test.didWork }classpath = standaloneJar.outputs.filesmain "fitnesseMain.FitNesseMain"args "-o", "-c", "FitNesse.SuiteAcceptanceTests?suite&format=text"
}check.dependsOn acceptanceTesttask javadocJar(type: Jar) {mustRunAfter checkclassifier = 'javadoc'from javadoc
}task sourcesJar(type: Jar) {mustRunAfter checkclassifier = 'sources'from sourceSets.main.allSource
}task releaseTag(type: Exec) {commandLine 'git', 'tag', project.versiondoLast {println "Tagged release ${project.version}"}
}task publishTag(type: Exec) {commandLine 'git', 'push', '--tags'shouldRunAfter releaseTag
}task prepareSnapshotRepo {bintray.pkg.repo = 'edge'
}task prepareReleaseRepo {bintray.pkg.repo = 'release'
}bintrayUpload.mustRunAfter prepareSnapshotRepo, prepareReleaseRepotask snapshotRelease {dependsOn prepareSnapshotRepo, bintrayUpload
}task release {dependsOn releaseTag, prepareReleaseRepo, bintrayUpload, publishTag
}clean {delete "lib"
}publishing {publications {FitNesseRelease(MavenPublication) {from components.javaartifact sourcesJarartifact javadocJarartifact standaloneJarartifact slimJargroupId 'org.fitnesse'artifactId 'fitnesse'pom.withXml {asNode().get('version') + {resolveStrategy = Closure.DELEGATE_FIRSTname('FitNesse')description('The fully integrated standalone wiki, and acceptance testing framework.')url('http://fitnesse.org')packaging('jar')}asNode().append(pomLicenses())asNode().append(pomScm())asNode().append(pomDevelopers())// Clean up scope entries added by the pom generator:asNode().dependencies.'*'.findAll() {if (project.configurations.optional.allDependencies.find { dep -> dep.name == it.artifactId.text()}) {def xmlOptional = it.optional[0]if ( !xmlOptional ) {xmlOptional = it.appendNode('optional')}xmlOptional.value = 'true'}}}}}
}bintray {user = System.getenv("BINTRAY_USER") ?: 'Define your Bintray user name in BINTRAY_USER'key = System.getenv("BINTRAY_API_KEY") ?: 'Define your Bintray BINTRAY_API_KEY'publications = ['FitNesseRelease']publish = truepkg {name = 'fitnesse'userOrg = 'fitnesse'licenses = ['CPL-1.0']websiteUrl = 'http://fitnesse.org'vcsUrl = 'https://github.com/unclebob/fitnesse.git'publicDownloadNumbers = truegithubRepo = 'unclebob/fitnesse'version {name = project.versiondesc = "FitNesse release ${project.version}"vcsTag = project.versiongpg {sign = true}}}
}wrapper {gradleVersion = '5.3.1'
}def pomLicenses() {new NodeBuilder().licenses {license {name 'Common Public License version 1.0'url 'http://www.opensource.org/licenses/cpl1.0'distribution 'repo'}}
}def pomScm() {new NodeBuilder().scm {connection 'scm:git:git://github.com/unclebob/fitnesse.git'developerConnection 'scm:git:git@github.com:unclebob/fitnesse.git'url 'scm:git:http://github.com/unclebob/fitnesse'}
}def pomDevelopers() {new NodeBuilder().developers {developer {id 'unclebob'name 'Robert C. Martin'email 'unclebob@cleancoder.com'}}
}

修改完成后,refresh一下gradle项目,会根据build.gradle文件的配置,对项目进行以下更新。

现在运行一下,可能会发现有空指针的现象,定位后发现,缺少Resources文件夹。所以需要导入一下这个资源文件夹。可以直接导入fitnesse-standalone.jar中的Resources文件夹,这样可以解决空指针的问题。另外,src/fitnesse/resources/bootstrap下没有css样式文件夹,这个也需要从fitnesse-standalone.jar中导入进来。
缺少的css样式

缺少的Resources文件目录

三、运行和构建

踩了一系列的坑之后,终于可以运行了,运行的结果正是我们想要看到的结果。

然后需要打包发布,这里遇到很多问题,可能打包成功后,运行报错。有错误的时候,百度不到也很正常,要善于思考,定会解决。刚开始不是很顺利,运行jar包缺少对应的模块,之后改了一下build.gradle的配置
,添加了下面一段话,就成功了。

打包的时候,需要进入gradle工程的主目录下,也就是build.gradle文件所在的目录下。运行命令:gradle jar,打包完成后,会在主目录下的build/libs下生成我们需要的jar文件。

fitnesse二次开发-项目部署相关推荐

  1. 架构师实战培训(架构设计+数据后台+快速开发+二次开发+发布部署)

    架构师实战培训(架构设计+数据后台+快速开发+二次开发+发布部署)系列视频课程 课程目标 学习MIS系统.高并发系统.单机系统设计思路: 理解设计模式,学会命令模式: 适用人群 CIO.CTO.技术总 ...

  2. 超全 泛微 E9 Ecology 9开发资料大全 开源资源下载 泛微E9二次开发 泛微开发实战经验 泛微开发实战例子 泛微二次开发项目例子 泛微二次开发Demo 泛微二次开发完整例子 泛微二次开发入门

            由于工作需要,E9在泛微一推出来,以前所在的企业就第一时间上线了,经过四年多的运行,功能强大再加上在上面开发非常多的业务,一般的企业员工只需要打开泛微就可以处理完平时信息化的业务.后来 ...

  3. python能二次开发cad么_2,手动创建CAD二次开发项目--AutoCAD二次开发(2020版)

    本项目使用手动创建,意为不使用SDK模板. 从Visual Studio的"文件"下拉菜单中,选择"新建"->"项目...". 在出现 ...

  4. JEECG开源社区, 成立了微信二次开发项目,欢迎有兴趣朋友参与

    JEECG的"微网站""微应用"案例终于出炉了,大家速来围观        功能点:         微网站:一个微信网站         微应用:我的楼盘  ...

  5. vs不想运行某个项目_Creo二次开发--项目搭建

    搭建环境介绍: 编译器:VS2010 头文件路径: [Creo安装目录]Common Files[版本号]prodevelopincludes [Creo安装目录]Common Files[版本号]p ...

  6. 鼎捷ERP二次开发教程 Tiptop GP开发资料大全 Tipto开发实战经验 鼎捷开发实战例子 Tiptop GP二次开发项目例子 4GL开发Demo 鼎捷二次开发完整例子 鼎捷ERP二次开发入门

    本人在ERP实施公司做顾问四五年,参与企业实施ERP十多个项目,非常熟悉企业ERP流程,在实施过程遇到众多问题,提出了不少根据企业具体情况的解决方案. 曾经参与鼎捷Tiptop GP实施十多个项目,具 ...

  7. AutoCAD C# 二次开发项目----批量替换块(2)

    项目总体规划 考虑到项目需求,决定采用AutoCAD中的Accoreconsole.exe+.Net Dll来实现,对Accoreconsole不太了解的同学可以自行百度,总之一句话,要想高效的批量处 ...

  8. Hadoop二次开发项目案例方案汇总

    大数据Hadoop应用开发技术正可谓如火如荼推进中,以为大数据已经不仅仅是局限在互联网领域,而是已经被上升到了国家战略的高度层面.大数据正在深刻影响和改变我们的日常生活和工作方式. Hadoop应用开 ...

  9. 二次开发qduoj部署前端修改记录

    一.部署教程 在搭建服务器上,git clone 目录网址 docker-compose up -d(一键部署) 二.前端镜像修改 git clone 目录网址 到对应文件夹修改自己需要修改的内容 网 ...

最新文章

  1. Ubuntu16.04里django的配置和安装
  2. 【转】互联网公司都有哪些行业
  3. 廖的python教程_学廖老师的python教程想到的
  4. php send helo/ehlo first错误,phpmailer发送邮件提示SMTP server error怎么回事?
  5. 阿里云高级技术专家赵伟:安全加速 SCDN 设计与案例
  6. java对象布局查看工具_Java 查看对象布局工具 - Java Object Layout
  7. 1:1 人脸比对 开源_在开源周宣布青年:1月13日至17日
  8. 变与不变: Undo构造一致性读的例外情况
  9. php取整数余数,js取整数、取余数的方法
  10. 思科网络学习笔记 | 路由概念
  11. docker安装nessus方法
  12. win10更新完提示未安装任何音频输出设备2019-11-13解决
  13. dhcp failover linux,Centos7 安装 DHCP 4.1 服务器配置及热备
  14. redis中数据倾斜问题的产生和解决方案
  15. 矩阵的主元+秩+矩阵等价
  16. 关于最新版mumu模拟器(2.2.16)安装xposed框架
  17. C++ 有关string类的基本语法以及一个简单算法 理论加案例的形式
  18. 程序的灵活性与可扩展性
  19. 大数据导出Excel导致内存溢出的解决方案
  20. 虚拟机 硬盘空间不足 磁盘最大大小调整的相对方法

热门文章

  1. Fingerprint Recognition
  2. 大学计算机实验五北理工,北京理工大学计算机实验五报告表
  3. 匹配表情emoji 正则_js判断替换emoji表情?
  4. 音响人烧电脑 篇一:花费700元,我是如何升级到i7级别的NAS
  5. AD域搭建与加入保姆级教程
  6. msbuild 语法_[独孤九剑]持续集成实践(二)– MSBuild语法入门
  7. 如何看懂Postgres的执行计划
  8. 菊厂220824第一题
  9. SOLIDWORKS中的两个基本概念
  10. android知乎日报中的动画,开发Android知乎日报(一)简介