Relative Path in rft

Source: Internet
Author: User
Relative PathThe problem is not Rft Automated TestingAll Code involved in team development must solve the problem of relative paths. There are also a variety of solutions. For J2EE programs, middleware provides a context environment and also writes the root directory in environment variables or configuration files. Yesterday, I saw the getoption method provided by rft in the Forum. It is very convenient to use it to implement the relative path and migration of scripts.
Assume that the path of the rft automated test project is D:/ci_automation/src. Then, under SRC, We have/data,/scr ready PT,/lib,/common ...... Folder, then we write the code as follows:

String S = (string) getoption (ioptionname. datastore); system. Out. println (s)
 
 

In this example, the getoption method is a static method provided by rft and can be called directly. ioptionname is an interface provided by rft. The specific function is unknown. This interface has a static string datastore class member variable, stores the directory of the rft project. The above code is used to return the directory of the rft project. The running result is D:/ci_automation/src.
When we need to reference the/common folder, we can write as follows:
String file = S + "// common // test.xls "//JavaDirectory separator is required //
In this way, we even save the environment variables. Of course, this method is also conditional, that is, the rft software must be installed on the test machine.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.