blob: 7cb1507ca741ddfd7a124ca0b90bedbfb0fe9703 [file] [log] [blame]
<!DOCTYPE html>
<head>
<title>RCPTT Documentation Center</title>
<meta charset="UTF-8">
<link rel="stylesheet" href="https://www.eclipse.org/rcptt/shared/css/bootstrap.min.css">
<link rel="stylesheet" href="https://www.eclipse.org/rcptt/shared/css/main.css">
<link rel="stylesheet" href="https://www.eclipse.org/rcptt/shared/css/prism.css">
<link rel="icon" href="https://www.eclipse.org/rcptt/shared/img/favicon.ico">
<script src="https://www.eclipse.org/rcptt/shared/js/jquery.min.js"></script>
<script src="https://www.eclipse.org/rcptt/shared/js/bootstrap.min.js"></script>
<script src="https://www.eclipse.org/rcptt/shared/js/prism.js"></script>
<script src="https://www.eclipse.org/rcptt/shared/js/ecl.js"></script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-39589807-5', 'eclipse.org');
ga('send', 'pageview');
</script>
</head>
<body>
<div id="before-footer">
<header>
<nav class="navbar navbar-default navbar-static-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<span class="navbar-brand">RCPTT Documentation Center</span>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li >
<a href="https://www.eclipse.org/rcptt/documentation/userguide/getstarted">User Guide</a>
</li>
<li class="active" >
<a href="https://www.eclipse.org/rcptt/documentation/faq/">FAQ</a>
</li>
<li>
<a href="http://eclipse.org/rcptt">Back to RCPTT Main Site</a>
</li>
<li>
<a href="http://eclipse.org">Eclipse.org</a>
</li>
</ul>
</div>
</nav>
</header>
<section class="content">
<div class="container">
<div class="row">
<div class="col-sm-3">
<div class="rcptt-sidebar">
<ul class="nav">
<li class="active" ><a href="https://www.eclipse.org/rcptt/documentation/faq/pass-value/">How to pass a value to a test during its execution?</a>
</li>
<li ><a href="https://www.eclipse.org/rcptt/documentation/faq/install-as-plugin/">Can RCPTT be installed as an Eclipse plugin?</a>
</li>
<li ><a href="https://www.eclipse.org/rcptt/documentation/faq/resize-window/">How to resize a window?</a>
</li>
<li ><a href="https://www.eclipse.org/rcptt/documentation/faq/extract-widget/">How to extract an SWT widget from ECL command?</a>
</li>
<li ><a href="https://www.eclipse.org/rcptt/documentation/faq/verify-control-size/">How to verify changing control sizes?</a>
</li>
<li ><a href="https://www.eclipse.org/rcptt/documentation/faq/suite-order/">Is it possible to order tests in a Test Suite?</a>
</li>
<li ><a href="https://www.eclipse.org/rcptt/documentation/faq/runtime-features/">What does each runtime feature stand for?</a>
</li>
<li ><a href="https://www.eclipse.org/rcptt/documentation/faq/get-property-raw/">What is the difference between Assert and Verify commands or how to get raw property values?</a>
</li>
</ul>
</div>
</div>
<div class="col-sm-9">
<h1>How to pass a value to a test during its execution.</h1>
<p></p>
<p>In case when it is required to pass some values to a test in command line, it is possible to do it like this:</p>
<ol>
<li>In AUT VM arguments pass desired parameters as Java properties, i.e. add arguments like this:
<pre>-DpropertyName=propertyValue </pre>
</li>
<li>Use ECL command <a href="http://download.eclipse.org/rcptt/release/1.5.4/doc/ecl/index.html#substitute-variables">substitute-variables</a> (which uses <b>org.eclipse.core.variables</b> plugin) to get a property value like this:</li>
<pre>//writes prop val to AUT workspace log
log [substitute-variables "${system_property:propertyName}"]</pre>
</ol>
<p>With aid of <a href="https://www.eclipse.org/rcptt/documentation/userguide/procedures/"> variables and user-defined procedures</a>, this becomes even more convenient:</p>
<ol>
<li>Create ECL context which consist of only one command, declaring global variables:
<pre>global [val prop1 [substitute-variables "${system_property:prop1}"]]
[val prop2 [substitute-variables "${system_property:prop2}"]]
[val prop3 [substitute-variables "${system_property:prop3}"]]</pre>
</li>
<li>Add this ECL context to project's default contexts in Project Settings<br></li>
<li>Access anywhere in ECL these properties using $-syntax:
<pre>concat $prop1 $prop2 $prop3 | show-alert</pre>
</li>
</ol>
<div class="panel panel-info">
<div class="panel-heading">
Important
</div>
<div class="panel-body">
When AUT does not include <b>org.eclipse.core.variables</b> plugin and hence command 'substitute-variables' fails, it is possible to use <a href="http://download.eclipse.org/rcptt/release/1.5.4/doc/ecl/index.html#get-java-property">get-java-property</a> to get JVM system property value.
</div></div>
</div>
</div>
</div>
</section>
<script src="https://www.eclipse.org/rcptt/shared/js/main.js"></script>
</body>