• 前置:

1.本机环境安装了maven并配置环境变量

2.本机环境安装了IDEA软件

3.本机环境安装了Java jdk 8版本

4.有一定java和maven基础

因为以上网上例子很多,就不再重复赘述了

一、新建maven项目,在生成的pom.xml中配置所需jar包

<?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>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<groupId>org.example</groupId>
<artifactId>Test</artifactId>
<version>1.0-SNAPSHOT</version> <dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8.21</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.5</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>dubbo-serialization-fastjson</artifactId>
<version>2.6.7</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.24</version>
</dependency>
<dependency>
<groupId>org.uncommons</groupId>
<artifactId>reportng</artifactId>
<version>1.1.4</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.hynnet</groupId>
<artifactId>jxl</artifactId>
<version>2.6.12.1</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.17</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.5</version>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
<!--这里设置关联的testNG.xml路径,项目根目录下的res文件夹里面-->
<suiteXmlFiles>
<file>testNG.xml</file>
</suiteXmlFiles>
<properties>
<property>
<name>usedefaultlisteners</name>
<value>false</value>
</property>
<property>
<name>listener</name>
<value>org.uncommons.reportng.HTMLReporter</value>
</property>
</properties>
</configuration>
</plugin>
</plugins>
</build>
</project>

此时右下角会弹出提示,选择“Import Changes”,会自动下载依赖

接下来要做的就是等它下载完成。

二、生成testng.xml

File->Settings-Plugins  下载Create TestNG XML 插件,重启IDEA即可。

打开testNG.xml

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Suite1">
<!-- 测试名称会在报告中显示-->
<test name="Get方法测试" verbose="2">
<classes>
<!--运行的test类名称-->
<class name="GetDemo" />
</classes>
</test>
<test name="Post方法测试" verbose="2">
<classes>
<class name="PostDemo"/>
</classes>
</test>
</suite>

至此所有配置完成

Java+TestNG+Maven+Excel+IDEA接口自动化入门(一)环境配置的更多相关文章

  1. selenium从入门到应用 - 1,环境准备(Java+TestNG+Maven+Selenium)

    本系列所有代码 https://github.com/zhangting85/simpleWebtest 本文将介绍一个Java+TestNG+Maven+Selenium的web自动化测试脚本环境的 ...

  2. Windows10 + eclipse + JDK1.8 + Apache Maven 3.6.0 + dl4j深度学习环境配置

    Windows10 + eclipse + JDK1.8 + Apache Maven 3.6.0 + dl4j深度学习环境配置 JDK下载安装请自行,并设置好环境变量1 查看Java版本C:\Use ...

  3. selenium第一课(selenium+java+testNG+maven)

    selenium介绍和环境搭建 一.简单介绍 1.selenium:Selenium是一个用于Web应用程序测试的工具.Selenium测试直接运行在浏览器中,就像真正的用户在操作一样.支持的浏览器包 ...

  4. 自动化测试:java + testng + maven + reportng + jenkins + selenium (一)_基于win环境

    集成环境:jdk1.7 + tomcat1.7+ eclipse mars + maven + testng6.14.2 + selenium-java2.40.0 + reportng1.1.4 + ...

  5. selenium+java+testNG+maven环境搭建

    一.简单介绍 1.selenium: Selenium是一个用于Web应用程序测试的工具.Selenium测试直接运行在浏览器中,就像真正的用户在操作一样.支持的浏览器包括IE.Mozilla Fir ...

  6. Java入门和环境配置ideaJ安装

    Java入门及环境搭建 目录 Java入门及环境搭建 什么是Java Java Java的发展 Java的特性和优势 Java三大版本 JDK JRE JVM JAVA开发环境搭建 安装JDK 卸载J ...

  7. <spark入门><Intellj环境配置><scala>rk入门><Intellj环境配置><scala>

    # 写在前面: 准备开始学spark,于是准备在IDE配一个spark的开发环境. 嫌这篇格式不好的看这里链接 用markdown写的,懒得调格式了,么么哒 # 相关配置: ## 关于系统 * mac ...

  8. CTF必备技能丨Linux Pwn入门教程——环境配置

    说在前面 这是一套Linux Pwn入门教程系列,作者依据Atum师傅在i春秋上的Pwn入门课程中的技术分类,并结合近几年赛事中出现的一些题目和文章整理出一份相对完整的Linux Pwn教程. 问:为 ...

  9. web端自动化——Selenium Server环境配置

    Selenium Server环境配置 下面下载.配置并运行Selenium Server. ①    下载 Selenium Server. 下载地址为:https://pypi.python.or ...

随机推荐

  1. [TimLinux] Python nonlocal和global的作用

    1. 执行代码 以下实例都是通过执行以下代码,需要把以下执行代码放在后面实例代码的后面. a = outer_func()print("call a()") a() a() a() ...

  2. vuex简单使用。

    项目结构: 1:首先在项目中新建store.js文件,.js文件内容如下: import Vue from 'vue' import Vuex from 'vuex' Vue.use(Vuex) ex ...

  3. CSUOJ1811 Tree Intersection (启发式合并)

    Bobo has a tree with n vertices numbered by 1,2,…,n and (n-1) edges. The i-th vertex has color c i, ...

  4. imagenet-vgg-verydeep-19.mat格式详解

    .mat是matlab生成的文件.用matlab打开文件imagenet-vgg-verydeep-19.mat可以帮助理解其结构.matlab代码如下: a = open('D:\imagenet- ...

  5. 模拟实现 Promise(小白版)

    模拟实现 Promise(小白版) 本篇来讲讲如何模拟实现一个 Promise 的基本功能,网上这类文章已经很多,本篇笔墨会比较多,因为想用自己的理解,用白话文来讲讲 Promise 的基本规范,参考 ...

  6. Docker (二) Windows10专业版安装教程

    前言 本文将基于 windows10专业版 来安装docker 1.开启Hyper-V 温馨小提示:之前小编是windows10企业版没有Hyper-V这个功能,于是通过DockerToolbox安装 ...

  7. js中 forEach 和 map 区别

    共同点: 1.都是循环遍历数组中的每一项. 2.forEach()和map()里面每一次执行匿名函数都支持3个参数:数组中的当前项item,当前项的索引index,原始数组input. 3.匿名函数中 ...

  8. python学习-pandas

    import pandas as pd # DataForm 二维数据# print(pd.read_excel("datas.xlsx")) # 多行数据 - 加载表单s = p ...

  9. 来看下,C# WebService WSDL自动生成代码,数组参数的BUG。。。ArrayOfString

    ArrayOfString ArrayOfString ArrayOfString 解决C#客户端 ArrayOfString 参数问题.(希望搜索引擎能搜到,帮你解决神奇的ArrayOfString ...

  10. c#截取后台窗口的图片

    c#截取后台窗口的图片,自测可用,据说性能很一般,用用吧 struct RECT { public int Left; // x position of upper-left corner publi ...