简体   繁体   English

在使用Java的Eclipse IDE的testng框架中的哪里可以找到org.testng.TestNg包?

[英]Where I can found org.testng.TestNg package in testng framework using Eclipse IDE for Java?

I am designing a customized automation framework for testing, using Selenium Webdriver and Java. 我正在使用Selenium Webdriver和Java设计定制的自动化测试框架。

Now for reporting purpose I am trying to integrate TestNG framework with my project. 现在出于报告目的,我正在尝试将TestNG框架与我的项目集成。

Now I am having a GUI based interface which is containing some specifications, where particular feature and testcases can be selected. 现在,我有一个基于GUI的界面,其中包含一些规范,可以在其中选择特定的功能和测试用例。 Now I need to run this application first,then in turn it is going to trigger the TestNG framework using testng.xml . 现在,我需要先运行此应用程序,然后再使用testng.xml触发TestNG框架。

So I need to know how I should do this thing ? 所以我需要知道我该怎么做?

And also through different links I found to run the testng.xml some package named org.testng.TestNg is required, But I am not able to figure it out where it is existing? 而且通过不同的链接,我发现需要运行一个名为org.testng.TestNg的程序包来运行testng.xml,但是我不知道它存在于何处?

You may need to include testng jar file in your project to get the package. 您可能需要在项目中包含testng jar文件来获取软件包。 You can create testng.xml programatically refer this link . 您可以通过编程方式创建testng.xml引用此链接

Also you can run tests by adding a class having main function as below : 您还可以通过添加具有以下主要功能的类来运行测试:

public static void main(String[] args)
{
    org.testng.TestNG.main(args);
}

Where arguments will be testNG arguments eg java org.testng.TestNG testng1.xml [testng2.xml testng3.xml ...] 其中的参数将是testNG参数,例如java org.testng.TestNG testng1.xml [testng2.xml testng3.xml ...]

Update : To start using maven you can refer this link . 更新:要开始使用Maven,您可以参考此链接 If you are using Elipse IDE than you can also configure Maven with using M2E plugin for eclipse. 如果您使用的是Elipse IDE,则还可以使用M2E插件来配置Maven以进行Eclipse。 To confuigure Eclipse with maven please refere link . 要使用Maven配置Eclipse,请参考link

Now to use Maven with testNG and selenium you need to configure your Maven pom.xml file to inculde testNG and Selenium webdriver dependancies. 现在,要将Maven与testNG和硒一起使用,您需要配置Maven pom.xml文件以灌输testNG和Selenium Webdriver的依赖性。 Second please add my above main function in your class to run Testng form Jar. 其次,请在您的班级中添加我上面的主要功能以运行Testng形式的Jar。 Now using maven build commands please create a jar file for your project. 现在使用maven构建命令,请为您的项目创建一个jar文件。 Maven provides variety of plugins and you can use some of them as per your use. Maven提供了各种插件,您可以根据需要使用其中的一些插件。 However I will suggest you use maven-jar-plugin,maven-assembly-plugin. 但是我建议您使用maven-jar-plugin,maven-assembly-plugin。

Once you will run the Maven commands. 一旦您将运行Maven命令。 the jar or zip will be created in Target folder in your project directory. jar或zip文件将在项目目录的Target文件夹中创建。 You can run jar using java-jar jarname testng.xml. 您可以使用java-jar jarname testng.xml运行jar。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 org.testng.testNg的问题 - issue with the org.testng.testNg TestNG命令行不起作用(java org.testng.TestNG) - TestNG command line not working (java org.testng.TestNG ) 如何使用org.testng.TestNG将参数输入此测试运行中? - How can I get parameters into this test run using org.testng.TestNG? 获取 java.lang.ClassNotFoundException: org.testng.TestNG 错误 - Getting a java.lang.ClassNotFoundException: org.testng.TestNG Error org.glassfish.jersey.server.ContainerException:java.lang.NoClassDefFoundError:org.testng.TestNG? - org.glassfish.jersey.server.ContainerException: java.lang.NoClassDefFoundError: org.testng.TestNG? 错误无法找到或加载主类 org.testng.TestNG - error Could not find or load main class org.testng.TestNG 尝试通过命令行触发自动化测试,但看到'java.lang.ClassNotFoundException:org.testng.TestNG' - Attempting to trigger automation tests via command line but seeing 'java.lang.ClassNotFoundException: org.testng.TestNG' eclipse-软件包org.testng不存在 - eclipse - package org.testng does not exist 通过CLI执行testng.xml时出错:找不到或加载主类org.testng.TestNG - Error executing testng.xml through CLI : Could not find or load main class org.testng.TestNG NoClassDefFoundError: org/testng/TestNG - NoClassDefFoundError: org/testng/TestNG
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM