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一些坑的更多相关文章

  1. selenium第一课(selenium+java+testNG+maven)

    selenium介绍和环境搭建 一.简单介绍 1.selenium:Selenium是一个用于Web应用程序测试的工具.Selenium测试直接运行在浏览器中,就像真正的用户在操作一样.支持的浏览器包 ...

  2. Selenium WebDriver TestNg Maven Eclipse java 简单实例

    环境准备 前提条件Eclipse 已经安装过 TestNg ,Maven 插件 新建一个普通的java项目 点击右键 configure->convert to Maven Project 之后 ...

  3. Selenium+TestNG+Maven(2)

    转载自http://www.cnblogs.com/hustar0102/p/5885115.html selenium介绍和环境搭建 一.简单介绍 1.selenium:Selenium是一个用于W ...

  4. 2、TestNG+Maven+IDEA环境搭建

    前言: 主要进行TestNG测试环境的搭建 所需环境: 1.IDEA UItimate 2.JDK 3.Maven 一.创建工程 File –>new –>Project–>next ...

  5. TestNG+Maven+IDEA 自动化测试(二) TestNG.xml

    示例代码: https://github.com/ryan255/TestNG-Demo 项目代码结构参考上一章 TestNG+Maven+IDEA 自动化测试(一) 环境搭建 maven插件引入 & ...

  6. TestNG+Maven+IDEA 自动化测试(一) 环境搭建

    示例代码: https://github.com/ryan255/TestNG-Demo 所需环境: 1. IDEA UItimate 2. JDK 3. Maven 创建工程 一开始创建一个普通的m ...

  7. TestNG+Maven+IDEA环境搭建

    TestNG+Maven+IDEA环境搭建 前言: 主要进行TestNG测试环境的搭建 所需环境: 1.IDEA UItimate 2.JDK 3.Maven 一.创建工程 File –>new ...

  8. selenium从入门到应用 - 1,环境准备(Java+TestNG+Maven+Selenium)

    本系列所有代码 https://github.com/zhangting85/simpleWebtest 本文将介绍一个Java+TestNG+Maven+Selenium的web自动化测试脚本环境的 ...

  9. selenium+java+testNG+maven环境搭建

    一.简单介绍 1.selenium: Selenium是一个用于Web应用程序测试的工具.Selenium测试直接运行在浏览器中,就像真正的用户在操作一样.支持的浏览器包括IE.Mozilla Fir ...

随机推荐

  1. Hbase和Oracle的对比

    转自:http://www.cnblogs.com/chay1227/archive/2013/03/17/2964020.html 转自:http://blog.csdn.net/allen879/ ...

  2. Python——Button参数

    anchor:   指定按钮上文本的位置:  background(bg): 指定按钮的背景色:  bitmap:指定按钮上显示的位图:  borderwidth(bd): 指定按钮边框的宽度:  c ...

  3. sql行转列实例

    select gh ,xm , max(A.bz) as bz , max(A.jcz) as jcz , max(A.dl) as dl , max(A.czzx) as czzx , max(A. ...

  4. sql中的begin catch 。。。end catch 的用法

    begin catch ...end  catch 是用来处理异常的 begintry--SQLendtry begincatch--sql (处理出错动作)endcatch 我们将可能会出错的sql ...

  5. 如何消除原生Android网络状态上的惊叹号

    喜欢使用原生Android系统的朋友可能会发现自己的状态栏信号图标上经常有一个惊叹号标志. 这是怎么回事呢?原因是Android为了对网络状态进行检测,采用了一种叫做captive detection ...

  6. 安装mysql zip5.7版--安裝

    一直以来都习惯了使用MySQL安装文件(.exe),今天下载了一个.zip版本的MySQL,安装过程中遇到了一些问题,如下: 1.在MySQL官网上(http://dev.mysql.com/down ...

  7. Spring IOC注入接口多实现解决

    前期面试的时候被面试官问到,Spring注入某接口,而接口有多实现,应该如何处理.接口多实现很常见,但在业务逻辑开发中,需要考虑注入某接口的多个实现问题的情况并不多见.当时是一脸懵逼,目前有时间,就做 ...

  8. kubernetes(一)

      •Kubernetes介绍 1.背景介绍 云计算飞速发展 - IaaS - PaaS - SaaS Docker技术突飞猛进 - 一次构建,到处运行 - 容器的快速轻量 - 完整的生态环境 2.什 ...

  9. swagger2 如何匹配多个controller

    方法一:使用多个controller的共同拥有的父类,即精确到两个controller的上一级 @Bean public Docket createRestApi() { return new Doc ...

  10. XML中添加换行符

    网上说的说法大多是 可是我这里cuba框架用这个不是换行,下面这个才行 这也是转义字符, 为什么会是这样的?搞不懂,求大神告知! 另外 表示空格 表示回车