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 ...
随机推荐
- NOIP赛前模拟20171027总结
题目: 1.寿司 给定一个环形的RB串··要求经过两两互换后RB分别形成两段连续区域,求最少操作次数(算法时间O(n)) 2.金字塔 给定一个金字塔的侧面图有n层··已知每一层的宽度··高度均为1·· ...
- Java24种设计模式的优点、缺点和适用环境总结
一.7个常用的面向对象设计原则 1.单一职责原则: 它是实现高内聚.低耦合的指导方针:一个对象应该只包含单一的职责,并且该职责被完整的封装在一个类中: 2.开闭原则: 指软件实体应尽量在不改变原有的代 ...
- 【bzoj3098】Hash Killer II 生日悖论
这天天气不错,hzhwcmhf神犇给VFleaKing出了一道题:给你一个长度为N的字符串S,求有多少个不同的长度为L的子串.子串的定义是S[l].S[l + 1].… S[r]这样连续的一段.两个字 ...
- java Logger 的使用与配置
原文来自:http://blog.csdn.net/nash603/article/details/6749914 Logger所对应的属性文件在安装jdk目录下的jre/lib/logging.pr ...
- BeanFactory到WebApplicationContext的结构 以及bean和spring容器的关系
BeanFactory: Ioc 容器 ApplicationContext: Spring容器 WebApplicationContext需要ServletContext实例,也就是说它必须在拥有W ...
- PHP中的验证码类(验证码功能设计之二)
运行结果: <!--vcode.class.php内容--> <?php class Vcode { private $width; //宽 private $height; //高 ...
- Visual Code 自定义插件安装位置
修改快速方式通过传入方式启动 ,示例: D:\installed_green_soft\VSCode\Code.exe --extensions-dir "D:\installed_gree ...
- 手機 停充的種類 與 量測 power consumption 功率 使用 bq25896 bq25890
Precondition : 配有 power path 功能的 BQ2589 手機. 接上 pc usb port. Origin : 今天有同事問我, 手機是否可以在接上 pc usb port ...
- LeetCode OJ--Permutations *
https://oj.leetcode.com/problems/permutations/ 写出一列数的全排列 #include <iostream> #include <vect ...
- Python Challenge 第五关
进入第五关,一张图和一行提示: pronounce it.右键源代码,只有一行注释: <!-- peak hell sounds familiar ? --> peak hell 听起来熟 ...