开发者

A basic question on java/TestNG

开发者 https://www.devze.com 2023-04-08 20:19 出处:网络
After writing my first few Java test programs, I want to write corresponding TestNG classes. I am usin开发者_开发知识库g RHEL 5. I see that a typical directory looks like src/main/java and src/test/ja

After writing my first few Java test programs, I want to write corresponding TestNG classes. I am usin开发者_开发知识库g RHEL 5. I see that a typical directory looks like src/main/java and src/test/java.

(a) Who creates such directory? Do we create it manually? or there is a way to create test directory structure corresponding to main code dir structure.

(b) Also, how do I run these testNG classes from command line? Do I need to have any additional extra jars like testng.jar or something to support these annotations or these annotations are supported in default jdk 1.6?

(c) Also, when I create a TestNG class from Eclipse, it necessarily asks for a package name. Why is it so?


a) Who creates such directory? Do we create it manually? or there is a way to create test directory structure corresponding to main code dir structure.

Its created by some tool like Maven or yourself. Tools will just create a test folder, further folders/structure are purely specific to practices in your project.

(b) Also, how do I run these testNG classes from command line? Do I need to have any additional extra jars like testng.jar or something to support these annotations or these annotations are supported in default jdk 1.6?

Here is nice link which shows how to run TestNG classes from command line including the extra jars needed

(c) Also, when I create a TestNG class from Eclipse, it necessarily asks for a package name. Why is it so?

I don't any reason other than enforcing a fair practice.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号