Mac OS command line TestNG - “Cannot find class in classpath” error
直接eclipse执行.xml文件可以正确执行
在mac下执行却总报错:
[TestNG] [Error]
Cannot find class in classpath
最后解决办法,classpath格式错误,正确执行的格式:
先cd 到工程目录,
java -cp "lib/testng-6.9.10.jar:bin:lib/:target/test-classes/" -Djava.ext.dirs=lib org.testng.TestNG testSuits/testSuitExample_android.xml
lib bin target都是工程下的文件夹,
其中.class文件在target/test-classes/下,lib下是一些引用的jar包,待执行的文件testSuitExample_android.xml在testSuits目录下
mac下用:分隔;windows下用;分隔
详细的如何下dos prompt下执行TestNG见下面链接:
http://stackoverflow.com/questions/11896791/how-to-run-testng-from-dos-prompt
You need to have the testng.jar under classpath.
try C:\projectfred> java -cp "path-tojar/testng.jar:path_to_yourtest_classes" org.testng.TestNG testng.xml
Update:
Under linux I ran this command and it would be some thing similar on Windows either
test/bin# java -cp ".:../lib/*" org.testng.TestNG testng.xml
Directory structure:
/bin - All my test packages are under bin including testng.xml
/src - All source files are under src
/lib - All libraries required for the execution of tests are under this.
Once I compile all sources they go under bin directory. So, in the classpath I need to specify contents of bin directory and all the libraries like testng.xml, loggers etc over here. Also copy testng.xml to bin folder if you dont want to specify the full path where the testng.xml is available.
/bin
-- testng.xml
-- testclasses
-- Properties files if any.
/lib
-- testng.jar
-- log4j.jar
Update:
Go to the folder MyProject and type run the java command like the way shown below:-
java -cp ".: C:\Program Files\jbdevstudio4\studio\plugins\*" org.testng.TestNG testng.xml
I believe the testng.xml file is under C:\Users\me\workspace\MyProject if not please give the full path for testng.xml file
Mac OS command line TestNG - “Cannot find class in classpath” error的更多相关文章
- Awesome Mac OS Command Line 中文翻译
awesome-macos-command-line 收集了很多有趣的 Mac 终端命令. 看了一遍后,发现帮助很大. 见识许多没有使用过的命令,加深了对 Mac 的认识. 所以翻译成了中文,共享给其 ...
- Mac安装Command Line Tools
从App Store上下载的Xcode,默认是不会安装Command Line Tools的,Command Line Tools是在Xcode中的一款工具,可以在命令行中运行C程序. 在终端中输入命 ...
- How To Fix – Mcrypt PHP extension required in Laravel on Mac OS X (No MAMP)
Laravel PHP web framework requires certain libraries to function properly. One of these libraries is ...
- stderr: xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
错误提示: (1). stderr: xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer direc ...
- Enable rsh on MAC OS with command line
1. Enable rsh on macos. 1). os version (10.0) Enabling the "Allow remote login" option tur ...
- Xcode Command Line Tools for Mac OS X 10.9 Mavericks
by Daniel Kehoe Last updated 28 December 2013 How to install Apple Xcode Command Line Tools for Mac ...
- MAC OS 如何安装命令行工具:Command Line Tools
打开终端输入:xcode-select --install 回车 安装好了测试结果:gcc -v 显示如下: xcode-select: note: install requested for com ...
- Jenkins参数化构建(一)之 Maven Command Line传递TestNG构建参数
1. Maven使用 -D参数名称 将参数传递至所运行项目 Maven指定TestNg.xml文件 clean test -DsuiteXmlFile=src/main/resources/testn ...
- 怎样安装Command Line Tools in OS x Mavericks&Yosemite(Without xcode)--转载
How to Install Command Line Tools in OS X Mavericks & Yosemite (Without Xcode) Mac users who pre ...
随机推荐
- xsy 1790 - 不回头的旅行
from NOIP2016模拟题28 Description 一辆车,开始没油,可以选择一个点(加油站)出发 经过一个点i可加g[i]的油,走一条边减少len的油 没油的时候车就跪了 特别的,跪在加油 ...
- spring和resteasy 的集成方式
spring和resteasy集成,三种主要的方式, 对于和jboss as7的集成不需要做任何工作,jboss默认集成了resteasy,只需要对业务pojo做一些jax-rs的注解标注即可.这里讲 ...
- BZOJ 4077 Messenger
Messenger [问题描述] alice和bob各自在两条折线上行进,一个邮递员要从alice那拿一个包裹,并以直线移动到bob处,alice和bob.邮递员的速度均为1单位/s,问邮递员最少要走 ...
- vue.js源码学习分享(七)
var _Set; /* istanbul ignore if */ if (typeof Set !== 'undefined' && isNative(Set)) { // use ...
- Struts2的上传与下载
转自:http://blog.csdn.net/Mark_LQ/article/details/49822821 10.1.1 文件上传基本案例 第一步:上传组件依赖与commons-fileup ...
- TStringList,快速解析 查找测试。。。很有用,再也不用 FOR 循环了
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAABKAAAALHCAIAAAA2Gq0zAAAgAElEQVR4nOydeVgUV76wK5OZb5JJZi
- jQuery 1.4版本的15个新功能(现在已经发布到jquery1.8,特别是增强版的live事件,支持 submit , change , focus 和 blur 事件)
1.jQuery()创建DOM元素:支持传参设置属性 之前,jQuery可以通过 attr 方法设置元素的属性,既可传属性的名和值,也可以是包含几组特定 属性名值对 的 对象.在 jQuery 1.4 ...
- Jmeter骚操作—文件上传、下载
最近很多同学都在问jmeter上传.下载文件的脚本怎么做,要压测上传.下载文件的功能,脚本怎么做,网上查了都说的很含糊,这次呢,咱们就好好的把jmeter的上传下载文件好好缕缕,都整明白了,怎么个过程 ...
- POJ 3171 区间覆盖最小值&&线段树优化dp
Cleaning Shifts Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 4715 Accepted: 1590 D ...
- 缓存区溢出检测工具BED
缓存区溢出检测工具BED 缓存区溢出(Buffer Overflow)是一类常见的漏洞,广泛存在于各种操作系统和软件中.利用缓存区溢出漏洞进行攻击,会导致程序运行失败.系统崩溃.渗透测试人员利用这 ...