当前位置:网站首页>jenkins相关
jenkins相关
2022-06-12 14:18:00 【小小微的博客】
1、启动Jenkins命令:java -jar jenkins.war,在浏览器中输入Jenkins地址:http://localhost:8080/,打开主页
在系统管理-系统设置中配置JDK、MAVEN的安装路径(选择本地的jre/maven所在路径即可)
也可以修改Jenkins主目录,在系统环境变量中添加即可(注意路径中不能含有空格,否则不生效)
2.添加项目,选择maven项目,选择svn添加svn地址,记得要提前配置maven默认的setting文件,位置如下maven/conf/settings.xml文件,否则可能会出现报错,错误信息如下

3、Jenkins+junit,测试报告的路径必须是相对Jenkins的工作空间$WORKSPACE(也就是/home/jenkins/.jenkins/workspace/$product)的目录,如果生成的测试报告的目录不是这个,那么必须把报告拷贝到此目录中并配置构建后的动作

4、由于junit只支持一个线程的测试,所以Jenkins目前执行所有的测试类的时候都在同一个线程当中,如果有before这些动作,注意这些动作是否可被执行两次,否则需另想办法:
方法一:通过创建一个单独的父类,并令其仅能够执行一次,并在其他测试类的before中调用这个方法,具体如下,

package batch;
import cn.sunline.ltts.core.api.config.ConfigManagerFactory;
import cn.sunline.ltts.engine.LttsUnitTest;
public class TestParent{
private static TestParent intance = null;
public static TestParent getInstance(){
if(intance == null){
intance = new TestParent();
init();
}
return intance;
}
public static void init(){
System.out.println("---------------------------------------");
System.setProperty("log4j.configurationFile","ltts_log.xml");//log4j配置
System.setProperty("ltts.log.home", "logs");
System.setProperty("plugin.gloabl.conf.path", "plugin-global-conf.properties");
System.setProperty(ConfigManagerFactory.SETTING_FILE, "bat-conf/setting.bat.properties");
System.setProperty(ConfigManagerFactory.VM_ID, "batch");
LttsUnitTest.setUp();
}
}
方法二:创建TestAll,使用测试套件,在套件执行前执行before,套件使用方法如前面的junit相关日志

5、jenkins可以通过git下载代码,需要安装git的插件,安装的时候可能会提示有依赖的插件需要安装,如果jenkins所在机器无法在线安装插件的话可以通过离线下载插件,在jenkins中上传的方式安装
到jenkins官网中https://wiki.jenkins.io搜索插件名称,在搜索出来的页面单击版本名,即可下载hpi格式的离线包,在jenkins系统管理-插件管理-高级-上传,即可安装




6、构建的时候可能会提示缺少.bash_profile 文件,在jenkins的根目录中创建这个文件,知道maven的主目录,jre、maven的bin目录,内容如下

MAVEN_HOME=/usr/share/maven
PATH=$PATH:/opt/jdk/jre/bin:$MAVEN_HOME/bin
export MAVEN_HOME
export PATH
jenkins安装Performance Plugin插件后,就可以分析jmeter的测试结果jtl文件了
边栏推荐
- Details of bypassing safeseh mechanism by using modules that do not enable safeseh
- And, or, not equal, operator
- In C language, the main function calls another function, which is understood by assembly code
- Two months' experience in C language
- Player practice 18 xresample
- Variable parameters
- To SystemC Beginners: the first program
- Lua tvalue structure
- Player actual combat 16 xdecode class
- Communication flow analysis
猜你喜欢

Can you believe it? It took me only two days to develop a management system

完美收官|详解 Go 分布式链路追踪实现原理

TestEngine with ID ‘junit-vintage‘ failed to discover tests

面向优化科学研究领域的软件包
![[early knowledge of activities] list of recent activities of livevideostack](/img/d8/a367c26b51d9dbaf53bf4fe2a13917.png)
[early knowledge of activities] list of recent activities of livevideostack

Configuring OSPF pseudo connection for Huawei devices

ADB command (2) use monkey to test

Soft test (VI) Chrome browser installation selenium IDE

华为设备配置BGP AS号替换

How to package QT program learning records with inno setup
随机推荐
Common DOS commands
[wechat applet] 1 Introduction to wechat applet
IAT hook hijacking process API call
Sizeof calculation space size summary
En langage C, la fonction principale appelle une autre fonction et assemble le Code pour comprendre
3. Process concealment under the ring ----- continuous concealment and new opening prevention
JS (III) convert ES6 syntax to Es5 syntax
Reverse order of Excel
How to realize the bidding strategy that pays more attention to transformation in the company's operation Google sem
In C language, the main function calls another function, which is understood by assembly code
QT database realizes page turning function
Easygui query the company name in the document
Reverse analysis from x86 to x64tips
Pay attention to click and pursue more users to enter the website. What bidding strategy can you choose?
Introduction to QT reflection mechanism and signal slot mechanism
Create a slice slice pit using the make method
Lua callinfo structure, stkid structure resolution
Printing colored messages on the console with printf
你敢信?开发一个管理系统我只用了两天
C secret arts script Chapter 2 (detailed explanation of pointers) (Section 3)