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 ...
随机推荐
- ajax查看详细返回信息
查看详细成功返回信息: success : function(data, textStatus, jqXHR) { console.log(data); console.log(textStatus) ...
- CSS 的三种样式 内联 内部 外部
CSS:层叠样式表的缩写 就是 Cascading Style Sheets Cascading Style Sheets : 层叠样式表 优先级问题 :遵守就近原则 内联> 内部>外部 ...
- default配置页面一级菜单用于进入二级菜单
- 将自己的ubuntu18.04打包成镜像
将自己的ubuntu18.04打包成镜像 2018年11月10日 10:40:06 舌耳 阅读数:1590 先下载remastersys wget ftp://ftp.gwdg.de/pub/linu ...
- C#开发轻松入门--笔记
第一章 1-1 .NET简介 (02:11) 1-2 Visual Studio简介及安装 (03:23) 1-3 创建C#控制台程序 (04:14) 1-4 练习题 1-5 程序界面各部分介绍 (0 ...
- spring boot项目基本结构
/==================================Controller @Controller public class SimpleController { @Autowired ...
- python 模块之-pickle
Pickle的问题和所有其他编程语言特有的序列化问题一样,就是它只能用于Python,并且可能不同版本的Python彼此都不兼容,因此,只能用Pickle保存那些不重要的数据,不能成功地反序列化也没关 ...
- [踩过的坑]Elasticsearch.Net 官网示例的坑
经过昨天的ElasticSearch 安装,服务以及可以启动了,接下来就可以开发了,找到了官网提供的API以及示例,Es 官方提供的.net 客户端有两个版本一个低级版本: [Elasticsearc ...
- 不同版本的Chrom浏览器对应的ChromDriver的版本
附chromedriver与chrome的对应关系表: chromedriver版本 支持的Chrome版本 v2.40 v66-68 v2.39 v66-68 v2.38 v65-67 v2.37 ...
- python之各种装饰器的使用
""" 装饰器,带参数的装饰器,类的装饰器 判断是否为可迭代的 from collections import Iterable print(isinstance([1, ...