testNG helloWorld
1. 新建maven工程。File -> New -> Project -> Maven,不选Create from archetype,直接点击“Next”。GroupId和ArtifactId填TestHelloWorld。点击确认,完成新建。
2. src -> main -> java下新建java文件,内容如下:
public class RandomEmailGenerator {
public String emailGenerator(){
return "Have generate an email";
}
}
3. src -> test -> java下新建java文件,内容如下:
import org.testng.Assert;
import org.testng.annotations.Test; public class TestHelloWorld { @Test
public void testEmailGenerator(){
RandomEmailGenerator randomEmailGenerator = new RandomEmailGenerator();
String email = randomEmailGenerator.emailGenerator(); Assert.assertEquals(email, "Have generate an email");
}
}
4. pom.xml文件
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <groupId>TestHelloWorld</groupId>
<artifactId>TestHelloWorld</artifactId>
<version>1.0-SNAPSHOT</version> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> <dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies> </project>
5. 配置工程。
选择TestNG,class里选择TestHellWorld.java文件。

6. 运行
点击unname旁边的三角符号,将运行testNG测试用例。运行结果如下。

testNG helloWorld的更多相关文章
- Self20171218_Eclipse+TestNg HelloWorld
作为一个经典的入门例子,这里展示如何开始使用TestNG单元测试框架. 使用的工具 : TestNG 6.8.7 Maven 3 Eclipse IDE TestNG下载并安装 从这里 http:// ...
- ant+jenkins+testng+selenium集成环境搭建
一.前序工作 下载ant:http://ant.apache.org/bindownload.cgi 下载jenkins:http://jenkins-ci.org/ 下载testng:http:// ...
- Selenium2(webdriver)入门之TestNG的使用
一.在Eclipse中安装TestNG 1.打开eclipse-->help-->Install New Software-->Add,输入Name和Location后,点击OK. ...
- Selenium WebDriver TestNg Maven Eclipse java 简单实例
环境准备 前提条件Eclipse 已经安装过 TestNg ,Maven 插件 新建一个普通的java项目 点击右键 configure->convert to Maven Project 之后 ...
- Spring学习笔记2:Spring HelloWorld
1:IntelliJ新建Maven工程 2:pom文件加入Spring依赖 <project xmlns="http://maven.apache.org/POM/4.0.0" ...
- JAVA+SELENIUM+MAVEN+TESTNG框架(二)新建项目
1.新建maven项目 2.下载selenium的jar包,放入maven依赖库中 3.新增testng依赖库,build path->add libirary->testng 4.查看自 ...
- Selenium2(webdriver)入门之TestNG的安装与简单使用
上一篇已经搭建好了Eclipse+selenium2的环境,这一篇主要记录下TestNG的使用. 一.在Eclipse中安装TestNG 1.打开eclipse-->help-->Inst ...
- testNG断言
https://junit.org/junit4/javadoc/latest/org/junit/Assert.html#assertThat 断言:Hamcrest - Matchers 对象: ...
- TestNG入门到...
目录 一.概述 二.@Test注解常用参数 三.测试中常用的断言(assert) 四.TestNG常用注解及使用 五.配置文件xml常用标签 六.参数传递 七.测试报告 一.概述 1.TestNG是一 ...
随机推荐
- cesium地形瓦片(HeightMap)格式
目录 1.瓦片切分规则 2..terrain瓦片格式分析 参考资料: heightmap 1.0 Tile Map Service Specification 国内主要地图瓦片坐标系定义及计算原理 H ...
- SpringCloud Gateway跨域配置
Springboot版本:2.1.8.RELEASE SpringCloud版本:Greenwich.SR2 yml配置: spring: cloud: gateway: globalcors: co ...
- java8在Stream的forEach操作时获取index
import java.util.Objects; import java.util.function.BiConsumer; /** * * @author yangzhilong * @dat ...
- x3d
目录 3d format introduction x3d resources open source C++ implementations file formats 1. Feature matr ...
- tp使用ajaxReturn返回二维数组格式的字符串,前台如何获取非乱码
参考: https://www.cnblogs.com/jiqing9006/p/5000849.html https://blog.csdn.net/zengxiangxuan123456/arti ...
- Linux部署springboot项目,两种方式
部署jar包(官方推荐) 在linux服务器上运行Jar文件时通常的方法是: $ java -jar test.jar 这种方式特点是ssh窗口关闭时,程序中止运行.或者是运行时没法切出去执行其他任务 ...
- Appium之Toast元素识别
问题思考 在日常使用App过程中,经常会看到App界面有一些弹窗提示(如下图所示)这些提示元素出现后等待3秒左右就会自动消失,那么我们该如何获取这些元素文字内容呢? Toast简介 Android中的 ...
- 玩转Linux
玩转Linux操作系统 说明:本文中对Linux命令的讲解都是基于名为CentOS的Linux发行版本,我自己使用的是阿里云服务器,系统版本为CentOS Linux release 7.6.1810 ...
- web基础---->script标签的特殊使用
今天要讲的就是怎样使用<script>去请求一个servlet,加载一些js资源以及额外的逻辑处理: 目录: JS的引入的几种方式 在script的标签中引入Servlet 动态引入JS的 ...
- Kubernetes k8s 基于Docker For Windows
开启和安装Kubernetes k8s 基于Docker For Windows 0.最近发现,Docker For Windows Stable在Enable Kubernetes这个问题上 ...