• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java RobotKeyword类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.robotframework.javalib.annotation.RobotKeyword的典型用法代码示例。如果您正苦于以下问题:Java RobotKeyword类的具体用法?Java RobotKeyword怎么用?Java RobotKeyword使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RobotKeyword类属于org.robotframework.javalib.annotation包,在下文中一共展示了RobotKeyword类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: patchRequest

import org.robotframework.javalib.annotation.RobotKeyword; //导入依赖的package包/类
@RobotKeyword(" Send a PATCH request on the session object found using the\n\n"
		 + "given `alias`\n\n"
		 + "``alias`` that will be used to identify the Session object in the cache\n\n"
		 + "``uri`` to send the PATCH request to\n\n"
		 + "``data`` a dictionary of key-value pairs that will be urlencoded and sent as PATCH data or binary data that is sent as the raw body content\n\n"
		 + "``headers`` a dictionary of headers to use with the request\n\n"
		 + "``files`` a dictionary of file names containing file data to PATCH to the server\n\n"
		 + "\n\n"
		 + "``allow_redirects`` Boolean. Set to True if redirect following is allowed.\n\n"
		 + "``timeout`` connection timeout")
@ArgumentNames({ "alias", "uri", "data={}", "headers={}", "files={}", "allow_redirects=False", "timeout=0" })
public ResponseData patchRequest(String alias, String uri, String... params) {
	RestClient rc = new RestClient();
	Object dataList = (String) Robot.getParamsValue(params, 0, "");
	if (Robot.isDictionary(dataList.toString())) {
		dataList = (Map<String, String>) Robot.getParamsValue(params, 0,
				(Map<String, String>) new HashMap<String, String>());
	}
	Map<String, String> headers = Robot.getParamsValue(params, 1,
			(Map<String, String>) new HashMap<String, String>());
	Map<String, String> files = Robot.getParamsValue(params, 2,
			(Map<String, String>) new HashMap<String, String>());
	Boolean allowRedirects = Boolean.parseBoolean(Robot.getParamsValue(params, 3, "false"));
	rc.makePatchRequest(alias, uri, dataList, headers, files, allowRedirects);
	return rc.getSession(alias).getResponseData();
}
 
开发者ID:Hi-Fi,项目名称:robotframework-httprequestlibrary,代码行数:27,代码来源:Patch.java


示例2: deleteRequest

import org.robotframework.javalib.annotation.RobotKeyword; //导入依赖的package包/类
@RobotKeyword(" Send a DELETE request on the session object found using the\n\n"
		 + "given `alias`\n\n"
		 + "``alias`` that will be used to identify the Session object in the cache\n\n"
		 + "``uri`` to send the DELETE request to\n\n"
		 + "``data`` a dictionary of key-value pairs that will be urlencoded and sent as DELETE data or binary data that is sent as the raw body content\n\n"
		 + "``params`` url parameters to append to the uri\n\n"
		 + "``headers`` a dictionary of headers to use with the request\n\n"
		 + "\n\n"
		 + "``allow_redirects`` Boolean. Set to True if redirect following is allowed.\n\n"
		 + "``timeout`` connection timeout")
@ArgumentNames({ "alias", "uri", "data={}", "params={}", "headers={}", "allow_redirects=False", "timeout=0" })
public ResponseData deleteRequest(String alias, String uri, String... params) {
	RestClient rc = new RestClient();
	Object dataList = (String) Robot.getParamsValue(params, 0, "");
	if (Robot.isDictionary(dataList.toString())) {
		dataList = (Map<String, String>) Robot.getParamsValue(params, 0,
				(Map<String, String>) new HashMap<String, String>());
	}
	Map<String, String> paramList = Robot.getParamsValue(params, 1,
			(Map<String, String>) new HashMap<String, String>());
	Map<String, String> headers = Robot.getParamsValue(params, 2,
			(Map<String, String>) new HashMap<String, String>());
	Boolean allowRedirects = Boolean.parseBoolean(Robot.getParamsValue(params, 3, "true"));
	rc.makeDeleteRequest(alias, uri, dataList, paramList, headers, allowRedirects);
	return rc.getSession(alias).getResponseData();
}
 
开发者ID:Hi-Fi,项目名称:robotframework-httprequestlibrary,代码行数:27,代码来源:Delete.java


示例3: createSession

import org.robotframework.javalib.annotation.RobotKeyword; //导入依赖的package包/类
@RobotKeyword("Create a HTTP session to a server\n\n"
		 + "``url`` Base url of the server\n\n"
		 + "``alias`` Robot Framework alias to identify the session\n\n"
		 + "``headers`` Dictionary of default headers\n\n"
		 + "``auth`` List of username & password for HTTP Basic Auth\n\n"
		 + "``timeout`` Connection timeout\n\n"
		 + "\n\n"
		 + "``proxy`` Dictionary that contains proxy information. Only one proxy supported per session. Dictionary should contain at least following keys: *protocol*, *host* and *port* of proxy. It can also contain *username* and *password*\n\n"
		 + "``verify`` Whether the SSL cert will be verified. A CA_BUNDLE path can also be provided.\n\n"
		 + "``debug`` Enable http verbosity option more information\n\n")
@ArgumentNames({ "alias", "url", "headers={}", "cookies=None", "auth=None", "timeout=None", "proxy=None",
		"verify=False", "debug=False" })
public void createSession(String alias, String url, String... params) {
	RestClient rc = new RestClient();
	Map<String, String> headers = Robot.getParamsValue(params, 0, new HashMap<String, String>());
	
	Proxy proxy = new Proxy(Robot.getParamsValue(params, 4, new HashMap<String, String>()));
	String verify = Robot.getParamsValue(params, 5, "False");
	Boolean debug = Boolean.parseBoolean(Robot.getParamsValue(params, 6, "False"));
	RobotLogger.setDebugToAll(debug);
	Authentication auth = Authentication
			.getAuthentication(Robot.getParamsValue(params, 2, (List<String>) new ArrayList<String>()));
	rc.createSession(alias, url, headers, auth, verify, debug, proxy);
}
 
开发者ID:Hi-Fi,项目名称:robotframework-httprequestlibrary,代码行数:25,代码来源:Session.java


示例4: createDigestSession

import org.robotframework.javalib.annotation.RobotKeyword; //导入依赖的package包/类
@RobotKeyword("Create a HTTP session to a server\n\n"
		 + "``url`` Base url of the server\n\n"
		 + "``alias`` Robot Framework alias to identify the session\n\n"
		 + "``headers`` Dictionary of default headers\n\n"
		 + "``auth`` List of username & password for HTTP Digest Auth\n\n"
		 + "``timeout`` Connection timeout\n\n"
		 + "\n\n"
		 + "``proxy`` Dictionary that contains proxy information. Only one proxy supported per session. Dictionary should contain at least following keys: *protocol*, *host* and *port* of proxy. It can also contain *username* and *password*\n\n"
		 + "``verify`` Whether the SSL cert will be verified. A CA_BUNDLE path can also be provided.\n\n"
		 + "``debug`` Enable http verbosity option more information\n\n")
@ArgumentNames({ "alias", "url", "headers={}", "cookies=None", "auth=None", "timeout=None", "proxy=None",
		"verify=False", "debug=False" })
public void createDigestSession(String alias, String url, String... params) {
	RestClient rc = new RestClient();
	Map<String, String> headers = Robot.getParamsValue(params, 0, new HashMap<String, String>());
	Proxy proxy = new Proxy(Robot.getParamsValue(params, 4, new HashMap<String, String>()));
	String verify = Robot.getParamsValue(params, 5, "False");
	Boolean debug = Boolean.parseBoolean(Robot.getParamsValue(params, 6, "False"));
	RobotLogger.setDebugToAll(debug);
	Authentication auth = Authentication.getAuthentication(
			Robot.getParamsValue(params, 2, (List<String>) new ArrayList<String>()), Authentication.Type.DIGEST);
	rc.createSession(alias, url, headers, auth, verify, debug, proxy);
}
 
开发者ID:Hi-Fi,项目名称:robotframework-httprequestlibrary,代码行数:24,代码来源:Session.java


示例5: getRequest

import org.robotframework.javalib.annotation.RobotKeyword; //导入依赖的package包/类
@RobotKeyword(" Send a GET request on the session object found using the\n\n"
		 + "given `alias`\n\n"
		 + "``alias`` that will be used to identify the Session object in the cache\n\n"
		 + "``uri`` to send the GET request to\n\n"
		 + "``params`` url parameters to append to the uri\n\n"
		 + "``headers`` a dictionary of headers to use with the request\n\n"
		 + "\n\n"
		 + "``allow_redirects`` Boolean. Set to True if redirect following is allowed.\n\n"
		 + "``timeout`` connection timeout")
@ArgumentNames({ "alias", "uri", "headers={}", "params={}", "allow_redirects=true", "timeout=0" })
public ResponseData getRequest(String alias, String uri, String... params) {
	RestClient rc = new RestClient();
	Boolean allowRedirects = Boolean.parseBoolean(Robot.getParamsValue(params, 2, "true"));
	Map<String, String> paramList = Robot.getParamsValue(params, 1,
			(Map<String, String>) new HashMap<String, String>());
	Map<String, String> headers = Robot.getParamsValue(params, 0,
			(Map<String, String>) new HashMap<String, String>());
	rc.makeGetRequest(alias, uri, headers, paramList, allowRedirects);
	return rc.getSession(alias).getResponseData();
}
 
开发者ID:Hi-Fi,项目名称:robotframework-httprequestlibrary,代码行数:21,代码来源:Get.java


示例6: headRequest

import org.robotframework.javalib.annotation.RobotKeyword; //导入依赖的package包/类
@RobotKeyword(" Send a HEAD request on the session object found using the\n\n"
		 + "given `alias`\n\n"
		 + "``alias`` that will be used to identify the Session object in the cache\n\n"
		 + "``uri`` to send the HEAD request to\n\n"
		 + "``headers`` a dictionary of headers to use with the request\n\n"
		 + "\n\n"
		 + "``allow_redirects`` Boolean. Set to True if redirect following is allowed.\n\n"
		 + "``timeout`` connection timeout")
@ArgumentNames({ "alias", "uri", "headers={}", "allow_redirects=False", "timeout=0" })
public ResponseData headRequest(String alias, String uri, String... params) {
	RestClient rc = new RestClient();
	Map<String, String> headers = Robot.getParamsValue(params, 0,
			(Map<String, String>) new HashMap<String, String>());
	Boolean allowRedirects = Boolean.parseBoolean(Robot.getParamsValue(params, 1, "false"));
	rc.makeHeadRequest(alias, uri, headers, allowRedirects);
	return rc.getSession(alias).getResponseData();
}
 
开发者ID:Hi-Fi,项目名称:robotframework-httprequestlibrary,代码行数:18,代码来源:Head.java


示例7: optionsRequest

import org.robotframework.javalib.annotation.RobotKeyword; //导入依赖的package包/类
@RobotKeyword(" Send a OPTIONS request on the session object found using the\n\n"
		 + "given `alias`\n\n"
		 + "``alias`` that will be used to identify the Session object in the cache\n\n"
		 + "``uri`` to send the OPTIONS request to\n\n"
		 + "``headers`` a dictionary of headers to use with the request\n\n"
		 + "\n\n"
		 + "``allow_redirects`` Boolean. Set to True if redirect following is allowed.\n\n"
		 + "``timeout`` connection timeout")
@ArgumentNames({ "alias", "uri", "headers={}", "allow_redirects=False", "timeout=0" })
public ResponseData optionsRequest(String alias, String uri, String... params) {
	RestClient rc = new RestClient();
	Map<String, String> headers = Robot.getParamsValue(params, 0,
			(Map<String, String>) new HashMap<String, String>());
	Boolean allowRedirects = Boolean.parseBoolean(Robot.getParamsValue(params, 1, "true"));
	rc.makeOptionsRequest(alias, uri, headers, allowRedirects);
	return rc.getSession(alias).getResponseData();
}
 
开发者ID:Hi-Fi,项目名称:robotframework-httprequestlibrary,代码行数:18,代码来源:Options.java


示例8: exportDataFromTable

import org.robotframework.javalib.annotation.RobotKeyword; //导入依赖的package包/类
@RobotKeyword("Exports the data from the given table into a file that is stored at the "
		+ "given location. The where-clause can (and should) be used to narrow the "
		+ "amount of rows that is exported this way. The file is stored in some "
		+ "simple XML-format and can be imported again to the database using the "
		+ "\"Import Data From File\" keyword. This way it is possible to store a set "
		+ "of testdata permanently retrieving it for example from some Live- or "
		+ "Demosystem. This keyword will probably have some issues if millions of "
		+ "rows are exported/imported using it. " + "\n\n"
		+ "*NOTE*: If using keyword remotely, file need to be trasfered to server some "
		+ "other way; this library is not doing the transfer.\n\n"
		+ "The keyword returns the amount of rows written to the XML-file. " + "\n\n"
		+ "Example: | ${ROWSEXPORTED}= | MySampleTable | /tmp/mysampletable.xml | Timestamp > sysdate-50 |")
@ArgumentNames({ "Table name", "Export file path (including name)", "Where clause=''" })
public int exportDataFromTable(String tableName, String filePath, String... whereClause)
		throws SQLException, DatabaseLibraryException, ParserConfigurationException,
		TransformerFactoryConfigurationError, TransformerException {
	new Assert().tableMustExist(tableName);
	String query = "Select * from " + tableName;
	if (whereClause.length > 0) {
		query += " where " + whereClause[0];
	}
	List<HashMap<String, Object>> data = queryRunner.executeSql(query);
	return writeQueryResultsToFile(tableName, filePath, data);
}
 
开发者ID:Hi-Fi,项目名称:robotframework-dblibrary,代码行数:25,代码来源:FileHandling.java


示例9: deleteAllRowsFromTable

import org.robotframework.javalib.annotation.RobotKeyword; //导入依赖的package包/类
@RobotKeyword("Deletes the entire content of the given database table. This keyword is"
		+ "useful to start tests in a clean state. Use this keyword with care as"
		+ "accidently execution of this keyword in a productive system will cause"
		+ "heavy loss of data. There will be no rollback possible.\n\n" + "Example: \n"
		+ "| Delete All Rows From Table | MySampleTable |")
@ArgumentNames({ "Table name" })
public void deleteAllRowsFromTable(String tableName) throws SQLException {
	String sql = "delete from " + tableName;

	Statement stmt = DatabaseConnection.getConnection().createStatement();
	try {
		stmt.execute(sql);
	} finally {
		stmt.close();
	}
}
 
开发者ID:Hi-Fi,项目名称:robotframework-dblibrary,代码行数:17,代码来源:Query.java


示例10: rowShouldNotExistInTable

import org.robotframework.javalib.annotation.RobotKeyword; //导入依赖的package包/类
@RobotKeyword("This keyword can be used to check the inexistence of content inside a "
		+ "specific row in a database table defined by a where-clause. This can be "
		+ "used to validate an exclusion of specific data from a table. " + "\n\n" + "Example: \n"
		+ "| Row Should Not Exist In Table | MySampleTable | Name='John Doe' | " + "\n\n"
		+ "This keyword was introduced in version 1.1. ")
@ArgumentNames({ "Table to check", "Where clause" })
public void rowShouldNotExistInTable(String tableName, String whereClause)
		throws SQLException, DatabaseLibraryException {

	String sql = "select * from " + tableName + " where " + whereClause;
	Statement stmt = DatabaseConnection.getConnection().createStatement();
	try {
		stmt.executeQuery(sql);
		ResultSet rs = (ResultSet) stmt.getResultSet();
		if (rs.next() == true) {
			throw new DatabaseLibraryException(
					"Row exists (but should not) for where-clause: " + whereClause + " in table: " + tableName);
		}
	} finally {
		stmt.close();
	}
}
 
开发者ID:Hi-Fi,项目名称:robotframework-dblibrary,代码行数:23,代码来源:Assert.java


示例11: transactionIsolationLevelMustBe

import org.robotframework.javalib.annotation.RobotKeyword; //导入依赖的package包/类
@RobotKeyword("Can be used to check that the database connection used for executing "
		+ "tests has the proper transaction isolation level. The string parameter "
		+ "accepts the following values in a case-insensitive manner: "
		+ "TRANSACTION_READ_UNCOMMITTED, TRANSACTION_READ_COMMITTED, "
		+ "TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE or " + "TRANSACTION_NONE. " + "\n\n"
		+ "Example: \n" + "| Transaction Isolation Level Must Be | TRANSACTION_READ_COMMITTED | ")
@ArgumentNames({ "Isolation level" })
public void transactionIsolationLevelMustBe(String levelName) throws SQLException, DatabaseLibraryException {

	String transactionName = new Information().getTransactionIsolationLevel();

	if (!transactionName.equals(levelName)) {
		throw new DatabaseLibraryException(
				"Expected Transaction Isolation Level: " + levelName + " Level found: " + transactionName);
	}

}
 
开发者ID:Hi-Fi,项目名称:robotframework-dblibrary,代码行数:18,代码来源:Assert.java


示例12: verifyNumberOfRowsMatchingWhere

import org.robotframework.javalib.annotation.RobotKeyword; //导入依赖的package包/类
@RobotKeyword("This keyword checks that a given table contains a given amount of rows "
		+ "matching a given WHERE clause. " + "\n\n"
		+ "For the example this means that the table \"MySampleTable\" must contain "
		+ "exactly 2 rows matching the given WHERE, otherwise the teststep will " + "fail. " + "\n\n"
		+ "Example: \n" + "| Verify Number Of Rows Matching Where | MySampleTable | [email protected] | 2 | ")
@ArgumentNames({ "Table to check", "Where clause", "Expected number of rows" })
public void verifyNumberOfRowsMatchingWhere(String tableName, String where, String rowNumValue)
		throws SQLException, DatabaseLibraryException {

	long rowNum = Long.valueOf(rowNumValue);

	long num = getNumberOfRows(tableName, where, (rowNum + 1));
	if (num != rowNum) {
		throw new DatabaseLibraryException("Expecting " + rowNum + " rows, fetched: " + num);
	}
}
 
开发者ID:Hi-Fi,项目名称:robotframework-dblibrary,代码行数:17,代码来源:Assert.java


示例13: disconnectFromDatabase

import org.robotframework.javalib.annotation.RobotKeyword; //导入依赖的package包/类
@RobotKeyword("Releases the existing connection to the database. In addition this"
		+ "keyword will log any SQLWarnings that might have been occurred on the connection.\n"
		+ "If current connection is closed and there's still some open, you have to activate that manually.\n"
		+ "Example:\n" + "| Disconnect from Database | default |")
@ArgumentNames({ "Database alias=default" })
public void disconnectFromDatabase(String... aliasParam) throws SQLException {
	String alias = aliasParam.length > 0 ? aliasParam[0] : defaultAlias;
	Connection disconnectingConnection = getConnection(alias);

	System.out.println(String.format("SQL Warnings on this connection (%s): %s", alias,
			disconnectingConnection.getWarnings()));
	disconnectingConnection.close();
	DatabaseConnection.connectionMap.remove(alias);
	if (alias.equals(DatabaseConnection.currentConnectionAlias)) {
		DatabaseConnection.currentConnectionAlias = "";
	}
}
 
开发者ID:Hi-Fi,项目名称:robotframework-dblibrary,代码行数:18,代码来源:DatabaseConnection.java


示例14: executeQuery

import org.robotframework.javalib.annotation.RobotKeyword; //导入依赖的package包/类
@RobotKeyword("Execute SQL Query. Returns a list of values. When the query selects a single column, a simple list of values is returned.\n"
		+ "When the query selects multiple columns a list of lists is returned.\n" +
"Example usage:\n"
+ " | @{singleColResult}= | Execute Query | select 1 from dual union select 2 from dual | \n"
+ " | Log Many | @{singleColResult} | | \n"	
+ " | @{multiColResult}= | Execute Query | select 1,2 from dual union select 3,4 from dual | \n"
+ " | Log Many | ${singleColResult[2]} | | \n")
// @formatter:on	
@ArgumentNames({ "sql" })
public List<Object> executeQuery(String sql) {

	List<String> sqls = new ArrayList<>();
	if (FileUtil.isSqlFileName(sql)) {
		sqls = FileUtil.parseSQLStatements(sql);
	} else {
		sqls.add(sql);
	}

	if (sqls.size() != 1) {
		throw new FileLibraryException("Only a single SQL Query is allowed in the .sql file for this keyword.");
	}

	StatementParser parser = new StatementParser(sqls.get(0));
	return service.getQueryResultsAsList(parser.getStatement(), TemplateContext.getInstance().resolveAttributes(parser.getParameters()), 0);
}
 
开发者ID:dvanherbergen,项目名称:robotframework-filelibrary,代码行数:26,代码来源:DatabaseKeywords.java


示例15: statement

import org.robotframework.javalib.annotation.RobotKeyword; //导入依赖的package包/类
@RobotKeyword("Execute SQL INSERT or UPDATE statement(s). Specify either an SQL directly or the path to a .sql file.")
@ArgumentNames({ "sql" })
public void executeSQL(String sql) {

	List<String> sqls = new ArrayList<>();
	if (FileUtil.isSqlFileName(sql)) {
		sqls = FileUtil.parseSQLStatements(sql);
	} else {
		sqls.add(sql);
	}

	for (String rawSql : sqls) {
		StatementParser parser = new StatementParser(rawSql);
		service.executeStatement(parser.getStatement(), TemplateContext.getInstance().resolveAttributes(parser.getParameters()));
	}
}
 
开发者ID:dvanherbergen,项目名称:robotframework-filelibrary,代码行数:17,代码来源:DatabaseKeywords.java


示例16: selectMenu

import org.robotframework.javalib.annotation.RobotKeyword; //导入依赖的package包/类
@RobotKeyword("Select a window menu by its label. Use '>' between different menu levels.\n\n Example:\n | Select Menu | _Help > About This Application_ |\n")
@ArgumentNames({ "menuPath" })
public void selectMenu(String menuPath) {

    // restore root context
    FormsContext.resetContext();

    // Extract the first menu label from the menu path
    String rootMenuLabel = TextUtil.getFirstSegment(menuPath, Constants.LEVEL_SEPARATOR);

    ContextChangeMonitor monitor = new ContextChangeMonitor();
    monitor.start();
    new MenuOperator(rootMenuLabel).select(menuPath);
    monitor.stop();

}
 
开发者ID:dvanherbergen,项目名称:robotframework-formslibrary,代码行数:17,代码来源:MenuKeywords.java


示例17: startRemoteServer

import org.robotframework.javalib.annotation.RobotKeyword; //导入依赖的package包/类
@RobotKeyword("Starts remote server. Mainly used for testing.\n\n"
		     +"Returns server port.")
@ArgumentNames({"*Remote port=selected automatically"})
public int startRemoteServer(String[] port) {
	RemoteServer.configureLogging();
	RemoteServer server = new RemoteServer();
	remoteServer = server;
       remoteServer.putLibrary("/", new RemoteSikuliLibrary());
	if (port.length > 0) {
		remoteServer.setPort(Integer.parseInt(port[0]));
	}
       try {
       	remoteServer.start();
       	return remoteServer.getLocalPort();
	} catch (Exception e) {
		SikuliLogger.logDebug(e.getStackTrace());
		throw new RuntimeException(e.getMessage());
	}
}
 
开发者ID:Hi-Fi,项目名称:remotesikulilibrary,代码行数:20,代码来源:Configuration.java


示例18: logTemplateData

import org.robotframework.javalib.annotation.RobotKeyword; //导入依赖的package包/类
@RobotKeyword("Print all content of the template data as JSON. When an optional file name argument is supplied, the template context is also saved as a JSON File.")
@ArgumentNames("outputFile=")
public String logTemplateData(String outputFilePath) {

	String contextString = TemplateContext.getInstance().toJSON();
	System.out.println("Template context: \n" + contextString);

	if (outputFilePath != null) {
		try {
			File outputFile = new File(outputFilePath);
			FileWriter writer = new FileWriter(outputFile);
			writer.append(TemplateContext.getInstance().toJSON());
			writer.close();
			System.out.println("Created '" + outputFile.getAbsolutePath() + "'");
		} catch (IOException e) {
			throw new FileLibraryException(e);
		}
	}
	return contextString;
}
 
开发者ID:dvanherbergen,项目名称:robotframework-filelibrary,代码行数:21,代码来源:ContextKeywords.java


示例19: putRequest

import org.robotframework.javalib.annotation.RobotKeyword; //导入依赖的package包/类
@RobotKeyword(" Send a PUT request on the session object found using the\n\n"
		 + "given `alias`\n\n"
		 + "``alias`` that will be used to identify the Session object in the cache\n\n"
		 + "``uri`` to send the PUT request to\n\n"
		 + "``data`` a dictionary of key-value pairs that will be urlencoded and sent as PUT data or binary data that is sent as the raw body content\n\n"
		 + "``params`` url parameters to append to the uri\n\n"
		 + "``headers`` a dictionary of headers to use with the request\n\n"
		 + "``files`` a dictionary of file names containing file data to PUT to the server\n\n"
		 + "\n\n"
		 + "``allow_redirects`` Boolean. Set to True if redirect following is allowed.\n\n"
		 + "``timeout`` connection timeout")
@ArgumentNames({ "alias", "uri", "data={}", "params={}", "headers={}", "files=", "allow_redirects=False",
		"timeout=0" })
public ResponseData putRequest(String alias, String uri, String... params) {
	RestClient rc = new RestClient();
	Object dataList = (String) Robot.getParamsValue(params, 0, "");
	if (Robot.isDictionary(dataList.toString())) {
		dataList = (Map<String, String>) Robot.getParamsValue(params, 0,
				(Map<String, String>) new HashMap<String, String>());
	}
	Map<String, String> paramList = Robot.getParamsValue(params, 1,
			(Map<String, String>) new HashMap<String, String>());
	Map<String, String> headers = Robot.getParamsValue(params, 2,
			(Map<String, String>) new HashMap<String, String>());
	Map<String, String> files = Robot.getParamsValue(params, 3,
			(Map<String, String>) new HashMap<String, String>());
	Boolean allowRedirects = Boolean.parseBoolean(Robot.getParamsValue(params, 4, "true"));
	rc.makePutRequest(alias, uri, dataList, paramList, headers, files, allowRedirects);
	return rc.getSession(alias).getResponseData();
}
 
开发者ID:Hi-Fi,项目名称:robotframework-httprequestlibrary,代码行数:31,代码来源:Put.java


示例20: responseCodeShouldBe

import org.robotframework.javalib.annotation.RobotKeyword; //导入依赖的package包/类
@RobotKeyword("Compares status code from latest response from given connection with given expected value.")
@ArgumentNames({"alias","expected HTTP status code"})
public void responseCodeShouldBe(String alias, int expectedCode) {
	RestClient rc = new RestClient();
	int actualStatusCode = rc.getSession(alias).getResponse().getStatusLine().getStatusCode();
	if (actualStatusCode != expectedCode) {
		throw new RuntimeException(String.format("Status code was not as expected. Expected %s, but got %s",
				expectedCode, actualStatusCode));
	}
}
 
开发者ID:Hi-Fi,项目名称:robotframework-httprequestlibrary,代码行数:11,代码来源:Assert.java



注:本文中的org.robotframework.javalib.annotation.RobotKeyword类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SnmpInt类代码示例发布时间:2022-05-22
下一篇:
Java ClipboardHolder类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap