# Alternative
#1
- run the .java source code file.
#
This
requires Robot to run
on JDK. Since
the tool
#
has
to compile the code before execution,
# this way is very slow.
Run
C:\testsuite\FileTest.java
file=C:\testsuite\data.txt
# If the "exists" variable is
not "true", exit the script.
if ("{exists}" !=
"true") {
Exit
1
}
|
|
|
|
import com.tplan.robot.scripting.*; import java.io.*;
public class FileTest extends DefaultJavaTestScript {
public void test() { try { String file = getContext().getVariableAsString("file"); File f = new File(file); getContext().setVariable("exists", f.exists()); } catch (Exception ex) { ex.printStackTrace(); } } }
|