testng+maven一些坑
1.
[TestNGContentHandler] [WARN] It is strongly recommended to add "<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"
>" at the top of your file, otherwise TestNG may fail or not work as expected.
需要在testng.xml中添加一行
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="testproj" parallel="false">
<test name="testDemo1">
<classes>
<class name="com.test.demo.SimpleTest.java"></class>
</classes>
</test>
</suite>
2.
org.testng.TestNGException: Cannot find class in classpath
原因是testng.xml的用例名称后缀加了.java
<class name="com.test.demo.SimpleTest.java"></class>
3.
报错source1.7不能调用lamber表达式
·将maven的settings.xml里面的jdk配置改成1.8的
<profile>
<id>jdk17</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
<!-- 文件拷贝时的编码 -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<!-- 编译时的编码 -->
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
</properties>
</profile>
·将eclipse的编码改成jdk1.8的
·将eclipse的maven的pom.xml的build-compiler指定jdk版本
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerArgs>
<arg>-Xlint:unchecked</arg>
<arg>-Xlint:deprecation </arg>
<!--<arg>endorseddirs=${endorsed.dir}</arg>-->
</compilerArgs>
</configuration>
</plugin>
4.
引入了testng的包,但是用着用着就忽然用不了了,红色划线报错。
· clean up工程,再maven-update
·第一条还不行,就删掉testng的repository,重新maven-update(我就是这么解决的)
5.
.jar which is referenced by the classpath, does not exist.
build path 里面,把relate的那些打叉的包全部remove
参考:https://www.cnblogs.com/xwdreamer/archive/2012/01/11/2318656.html
testng+maven一些坑的更多相关文章
- selenium第一课(selenium+java+testNG+maven)
selenium介绍和环境搭建 一.简单介绍 1.selenium:Selenium是一个用于Web应用程序测试的工具.Selenium测试直接运行在浏览器中,就像真正的用户在操作一样.支持的浏览器包 ...
- Selenium WebDriver TestNg Maven Eclipse java 简单实例
环境准备 前提条件Eclipse 已经安装过 TestNg ,Maven 插件 新建一个普通的java项目 点击右键 configure->convert to Maven Project 之后 ...
- Selenium+TestNG+Maven(2)
转载自http://www.cnblogs.com/hustar0102/p/5885115.html selenium介绍和环境搭建 一.简单介绍 1.selenium:Selenium是一个用于W ...
- 2、TestNG+Maven+IDEA环境搭建
前言: 主要进行TestNG测试环境的搭建 所需环境: 1.IDEA UItimate 2.JDK 3.Maven 一.创建工程 File –>new –>Project–>next ...
- TestNG+Maven+IDEA 自动化测试(二) TestNG.xml
示例代码: https://github.com/ryan255/TestNG-Demo 项目代码结构参考上一章 TestNG+Maven+IDEA 自动化测试(一) 环境搭建 maven插件引入 & ...
- TestNG+Maven+IDEA 自动化测试(一) 环境搭建
示例代码: https://github.com/ryan255/TestNG-Demo 所需环境: 1. IDEA UItimate 2. JDK 3. Maven 创建工程 一开始创建一个普通的m ...
- TestNG+Maven+IDEA环境搭建
TestNG+Maven+IDEA环境搭建 前言: 主要进行TestNG测试环境的搭建 所需环境: 1.IDEA UItimate 2.JDK 3.Maven 一.创建工程 File –>new ...
- selenium从入门到应用 - 1,环境准备(Java+TestNG+Maven+Selenium)
本系列所有代码 https://github.com/zhangting85/simpleWebtest 本文将介绍一个Java+TestNG+Maven+Selenium的web自动化测试脚本环境的 ...
- selenium+java+testNG+maven环境搭建
一.简单介绍 1.selenium: Selenium是一个用于Web应用程序测试的工具.Selenium测试直接运行在浏览器中,就像真正的用户在操作一样.支持的浏览器包括IE.Mozilla Fir ...
随机推荐
- div中的相对定位与绝对定位
1.position:relative; 如果对一个元素进行相对定位,首先它将出现在它所在的位置上.然后通过设置垂直或水平位置,让这个元素“相对于”它的原始起点进行移动.(再一点,相对定位时,无论是否 ...
- 莫烦theano学习自修第十天【保存神经网络及加载神经网络】
1. 为何保存神经网络 保存神经网络指的是保存神经网络的权重W及偏置b,权重W,和偏置b本身是一个列表,将这两个列表的值写到列表或者字典的数据结构中,使用pickle的数据结构将列表或者字典写入到文件 ...
- APP测试重点(转载)
1.安装卸载测试: app在不同的操作系统(安卓和ios),不同的版本,不同的机型上是否都能安装成功: 在安装过程中,突然断网或网络不好,是否给出有好的提示,网络恢复之后是否能正常下载: 在安装过 ...
- 提示“Web打印服务CLodop未安装启动”的各种原因和解决方法
旧版提示:"CLodop云打印服务(localhost本地)未安装启动!"新版提示:"Web打印服务CLodop未安装启动,点击这里下载执行安装(若此前已安装过,可点这里 ...
- struts2 核心过滤器的配置
<!-- struts2 过滤器核心配置--> <filter> <filter-name>struts2</filter-name> <filt ...
- Nginx 决策浏览器缓存是否有效
expires指令是告诉浏览器过期时间 syntax:expires [modified] time; eopch | max | off; default : off context :http,s ...
- notepad++上直接运行python文件
一.打开notepad++,点击语言,选择python,这样就写的是python文件了 二.点击运行>运行:输入cmd /k python "$(FULL_CURRENT_PATH)& ...
- YUV格式与RGB格式
YUV420介绍: YUV420格式是指,每个像素都保留一个Y(亮度)分量,而在水平方向上,不是每行都取U和V分量,而是一行只取U分量,则其接着一行就只取V分量,以此重复(即4:2:0, 4:0:2, ...
- 19JDBC初体验
一.JDBC常用类和接口 JDBC(Java DataBase Connectivity,java数据库连接)是一种用于执行SQL语句的Java API.JDBC是Java访问数据库的标准规范,可以为 ...
- BZOJ3676[Apio2014]回文串——回文自动机
题目描述 考虑一个只包含小写拉丁字母的字符串s.我们定义s的一个子串t的“出 现值”为t在s中的出现次数乘以t的长度.请你求出s的所有回文子串中的最 大出现值. 输入 输入只有一行,为一个只包含小写字 ...