Baidu document - something about api of
https://wenku.baidu.com/view/c1db6b1166ec102de2bd960590c69ec3d5bbdbfa.html?rec_flag=default&mark_pay_doc=2&mark_rec_page=1&mark_rec_position=3&mark_rec=view_r_1&clear_uda_param=1
https://wenku.baidu.com/view/5ce24fe1988fcc22bcd126fff705cc1755275f9a .html
Creation of automation projects
https://wenku.baidu.com/view/a75832ccb9f67c1cfad6195f312b3169a451ea86.html?rec_flag=default&mark_pay_doc=2&mark_rec_page=1&mark_rec_position=4&mark_rec=view_r_1&clear_uda_param=1Ali's
section
https://ask.seowhy.com/article/ 20600
Jenkins implements CI function
http://ju.outofmemory.cn/entry/331845
Pure interface test case
https://blog.csdn.net/Jane_Liee/article/details/78527859
Follow
https://www.cnblogs. com/findyou/p/5388853.html
package findyou.Interface;
import org.codehaus.jettison.json.JSONException;//jason parsing method
import org.codehaus.jettison.json.JSONObject;//jason parsing method
public class Common {
/**
* Parse Json content
*
* @author Findyou
* @version 1.0 2015/3/23
* @return JsonValue Returns the Value corresponding to JsonId in JsonString
**/
public static String getJsonValue(String JsonString, String JsonId) {
String JsonValue = "";
if (JsonString = = null || JsonString.trim().length() < 1) {//All leading and trailing spaces are removed
return null;
}
try {
JSONObject obj1 = new JSONObject(JsonString);
JsonValue = (String) obj1.getString(JsonId);// Get the value of the specified column in the current row of this ResultSet object in the form of String in the Java programming language
} catch (JSONException e) {
e.printStackTrace();////Print exception information on the command line where and why the error occurred in the program.
}
return JsonValue;
}
}
getCityWeathe.java source
package findyou.Interface;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
public class getCityWeather {
private String url="";
public String geturl() {
return url;
}
public String getHttpRespone(String cityCode) throws IOException {
String line = "";
String httpResults = "";
url=("http://www.weather.com.cn/data/cityinfo/"
+ cityCode + ".html");
try {
HttpURLConnection connection = URLConnection.getConnection(url);//Get the content of this URL connection.
DataOutputStream out = null;//Allows the application to write Java primitive data types to the underlying output stream in a machine-independent manner
connection.connect();//Use the connect method to establish the actual connection to the remote object.
out = new DataOutputStream(connection.getOutputStream());//getOutputStream is used to return the byte output stream object created by the servlet engine, and the servlet program can output the response body in byte form.
out.flush();
out.close();//Close this data output stream
BufferedReader reader = new BufferedReader(new InputStreamReader(//Wrap the character stream, put the character stream into the buffer, first read the characters into the buffer, until the buffer is full or you When flushing, read into memory again, which is designed to provide read efficiency
connection.getInputStream()));
while ((line = reader.readLine()) != null) {//Write once for each line read Input action
httpResults = httpResults + line.toString();//The ToString method will return a string that "represents" this object in text form
}
reader.close();
// disconnect
connection.disconnect();
} catch (Exception e) {
e.printStackTrace();
}
return httpResults;
}
}
4.URLConnection.java source code
Copy code
package findyou.Interface;
import java.net.HttpURLConnection;
import java.net.URL;
public class URLConnection {
public static HttpURLConnection getConnection(String url){
HttpURLConnection connection = null;
try {
// Open the connection to the URL
URL postUrl = new URL(url);
connection = (HttpURLConnection) postUrl.openConnection();
// Set common request properties
connection.setDoOutput(true);//Set whether to output
connection.setDoInput(true) to httpUrlConnection;// Set whether to read in from httpUrlConnection, by default it is true
connection.setRequestMethod("GET");//Set the request method to "get"
connection.setUseCaches(false);//Whether cache can be used, Post request cannot use cache
connection.setInstanceFollowRedirects(true);//Whether to use redirection
connection.setRequestProperty("Content-Type", "application/json");/ /Whether to use redirection
connection.setRequestProperty("Charset", "utf-8");//(If this is not set, java may be thrown when the serialized object is transmitted when the WEB service default is not this type. io.EOFException)
connection.setRequestProperty("Accept-Charset", "utf-8");//
} catch (Exception e) {
e.printStackTrace();
}
return connection;
}
}
https://wenku.baidu.com/view/c1db6b1166ec102de2bd960590c69ec3d5bbdbfa.html?rec_flag=default&mark_pay_doc=2&mark_rec_page=1&mark_rec_position=3&mark_rec=view_r_1&clear_uda_param=1
https://wenku.baidu.com/view/5ce24fe1988fcc22bcd126fff705cc1755275f9a .html
Creation of automation projects
https://wenku.baidu.com/view/a75832ccb9f67c1cfad6195f312b3169a451ea86.html?rec_flag=default&mark_pay_doc=2&mark_rec_page=1&mark_rec_position=4&mark_rec=view_r_1&clear_uda_param=1Ali's
section
https://ask.seowhy.com/article/ 20600
Jenkins implements CI function
http://ju.outofmemory.cn/entry/331845
Pure interface test case
https://blog.csdn.net/Jane_Liee/article/details/78527859
Follow
https://www.cnblogs. com/findyou/p/5388853.html
package findyou.Interface;
import org.codehaus.jettison.json.JSONException;//jason parsing method
import org.codehaus.jettison.json.JSONObject;//jason parsing method
public class Common {
/**
* Parse Json content
*
* @author Findyou
* @version 1.0 2015/3/23
* @return JsonValue Returns the Value corresponding to JsonId in JsonString
**/
public static String getJsonValue(String JsonString, String JsonId) {
String JsonValue = "";
if (JsonString = = null || JsonString.trim().length() < 1) {//All leading and trailing spaces are removed
return null;
}
try {
JSONObject obj1 = new JSONObject(JsonString);
JsonValue = (String) obj1.getString(JsonId);// Get the value of the specified column in the current row of this ResultSet object in the form of String in the Java programming language
} catch (JSONException e) {
e.printStackTrace();////Print exception information on the command line where and why the error occurred in the program.
}
return JsonValue;
}
}
getCityWeathe.java source
package findyou.Interface;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
public class getCityWeather {
private String url="";
public String geturl() {
return url;
}
public String getHttpRespone(String cityCode) throws IOException {
String line = "";
String httpResults = "";
url=("http://www.weather.com.cn/data/cityinfo/"
+ cityCode + ".html");
try {
HttpURLConnection connection = URLConnection.getConnection(url);//Get the content of this URL connection.
DataOutputStream out = null;//Allows the application to write Java primitive data types to the underlying output stream in a machine-independent manner
connection.connect();//Use the connect method to establish the actual connection to the remote object.
out = new DataOutputStream(connection.getOutputStream());//getOutputStream is used to return the byte output stream object created by the servlet engine, and the servlet program can output the response body in byte form.
out.flush();
out.close();//Close this data output stream
BufferedReader reader = new BufferedReader(new InputStreamReader(//Wrap the character stream, put the character stream into the buffer, first read the characters into the buffer, until the buffer is full or you When flushing, read into memory again, which is designed to provide read efficiency
connection.getInputStream()));
while ((line = reader.readLine()) != null) {//Write once for each line read Input action
httpResults = httpResults + line.toString();//The ToString method will return a string that "represents" this object in text form
}
reader.close();
// disconnect
connection.disconnect();
} catch (Exception e) {
e.printStackTrace();
}
return httpResults;
}
}
4.URLConnection.java source code
Copy code
package findyou.Interface;
import java.net.HttpURLConnection;
import java.net.URL;
public class URLConnection {
public static HttpURLConnection getConnection(String url){
HttpURLConnection connection = null;
try {
// Open the connection to the URL
URL postUrl = new URL(url);
connection = (HttpURLConnection) postUrl.openConnection();
// Set common request properties
connection.setDoOutput(true);//Set whether to output
connection.setDoInput(true) to httpUrlConnection;// Set whether to read in from httpUrlConnection, by default it is true
connection.setRequestMethod("GET");//Set the request method to "get"
connection.setUseCaches(false);//Whether cache can be used, Post request cannot use cache
connection.setInstanceFollowRedirects(true);//Whether to use redirection
connection.setRequestProperty("Content-Type", "application/json");/ /Whether to use redirection
connection.setRequestProperty("Charset", "utf-8");//(If this is not set, java may be thrown when the serialized object is transmitted when the WEB service default is not this type. io.EOFException)
connection.setRequestProperty("Accept-Charset", "utf-8");//
} catch (Exception e) {
e.printStackTrace();
}
return connection;
}
}