登录界面设置java sdk 和 maven
1.idea登录界面configure-project Defaults设置sdk.sdks

-
project Defaults 设置SDK
image.png

2.configure-Setting 设置maven


接下来是新建工程--配置git---删除本地创建文件idea里面的所有信息-----check out from version contrel 选择git---复制url---等等步骤看23天的简书.
下载代码4种方法
1.登录界面:check out from version contrel-选Git 下载
2.新建一个文件,在文件里右键git Bash Here 进去命令窗口 输入 git clone url 这url直接复制

-
右键 Paste 粘贴
image.png
image.png
-
file --OPEN
image.png
image.png
3.file-new-版本控制-Git 下载

4.tencent工蜂下载
腾讯工蜂
搜索:guoya-test-deom

-
可以点关注 下载
image.png
-
file-open 打开下载路径 我用2的路径举一个例子
image.png
autoAPI 新建一个java程序


idea连接数据库
1.先点右边Database--+号---Data source --Mysql

2.准备配置信息.域名 端口 用户名 密码



补充一张连接信息

3.数据库重命名

4.左下角显示连接的数据库

5.数据库如果你要执行SQL语句 先点数据库下的表名然后点 new console 不然要容易出错 如下顺序


idea连接远程服务器 可以看日志
1.Tools---deployment---Configuration

2.点+号 取一个名字 type 选择 SFTP

3.配置连接信息



-
会发现出现了乱码 怎么解决呢
-
file---setting---tools---SSH Terminal---选择UTF-8
image.png
-
File--other setting ---tools---SSH Terminal---选择UTF-8
image.png
image.png
*左下角 右键qa.guoyasoft---Close Session

-
乱码没了
image.png
-
Tools---start SSH session
image.png

连接服务器成功

结合 grep more命令后项定位日志 tail -200f 日志名实时刷新 这部分操作 请看前面简书 日志定位相关
远程仓库拉本地

或者

-
练习自动化代码正常流账户注册和登录 配置执行顺序testNG
image.png
image.png
import org.testng.Assert;
import org.testng.annotations.Test;
import java.util.HashMap;
import java.util.Map;
public class TestAPI1 {
@Test
public void userSignup(){
// 获取URL
String url = "http://qa.guoyasoft.com:8080/user/signup";
//获取参数
String data = "{\n" +
" \"phone\": \"13636602398\",\n" +
" \"pwd\": \"a123456\",\n" +
" \"rePwd\": \"a123456\",\n" +
" \"userName\": \"rdj85aaa\"\n" +
"}";
//doPost发送请求
String result = HttpClientUtil.doPost(url, "application/json", data);
//打印响应结果\
System.out.println(result);
//响应内容是否包含respCode":"0000
boolean actual = result.contains("\"respCode\":\"0000\"");
//断言
Assert.assertEquals(actual, true);
}
@Test
public void uesrLogin(){
//获取URL
String url = "http://qa.guoyasoft.com:8080/user/login";
String data = "{\n" +
" \"pwd\": \"a123456\",\n" +
" \"userName\": \"rdj85aa\"\n" +
"}";
String result = HttpClientUtil.doPost(url, "application/json", data);
System.out.println(result);
//响应正文是否包含"respCode":"0000"
boolean actual = result.contains("\"respCode\":\"0000\"");
//断言
Assert.assertEquals(actual,true);
}
}
- testNG 方法执行顺序 操作步骤参考昨天的简书
<suite name="suit1">
<test name="test0" preserve-order="true" enabled="true">
<classes>
<class name="com.guoyasoft.autoAPI.TestAPI1">
<methods>
<exclude name="userSignup" />
<include name="uesrLogin" />
</methods>
</class>
</classes>
</test>
</suite>



网友评论