blob: 3a4c5ff6d8217341b02e0416506b3d435bfd7656 [file] [log] [blame]
<!DOCTYPE html>
<head>
<title>RCPTT Blog</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">
<link rel="alternate" type="application/atom+xml" href="https://www.eclipse.org/rcptt/blog/atom.xml" title="RCP Testing Tool Blog"/>
<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>
<a href="https://www.eclipse.org/rcptt/blog"><span class="navbar-brand">RCPTT Blog</span></a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active" >
<a href="https://www.eclipse.org/rcptt/blog/">Latest Entries</a>
</li>
<li >
<a href="https://www.eclipse.org/rcptt/blog/categories">Categories</a>
</li>
<li >
<a href="https://www.eclipse.org/rcptt/blog/tags">Tags</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">
<article>
<header>
<h2>
<a href="https://www.eclipse.org/rcptt/blog/2014/12/10/test-about-dialog.html"> Testing About Dialog</a>
<small>Dec, 10, 2014 by Ivan Inozemtsev</small> </h2>
</header>
<div>
<p>In this post, I'm going to tell how to test an About dialog to ensure that all plug-ins are properly branded -- i.e. have correct provider name, plug-in name, etc.. While this information is rarely affects end users directly, it's still important to have it up-to-date, and it is really tedious to do such checks manually. Plus, it is a good demonstration of what RCPTT and ECL can do :).</p>
<p>Currently, some entries in RCPTT About dialog are not well-formed:</p>
<p><img src="https://www.eclipse.org/rcptt/shared/img/blog/about/about.png" /></p>
<p>So, let's create a test case for RCPTT, which ensures that all RCPTT plug-ins (i.e. plug-ins whose ID starts with <kbd>org.eclipse.rcptt</kbd>) are packaged correctly, i.e. that all its plug-ins meet the following requirements:</p>
<ul>
<li>Provider name is <kbd>Eclipse RCP Testing Tool Project</kbd></li>
<li>Plug-in name is not empty and ends with <kbd>(Incubation)</kbd></li>
<li>All plug-ins have a <span class="uiElement">Legal Info</span>
button enabled</li>
</ul>
<p><a href="https://www.eclipse.org/rcptt/blog/2014/12/10/test-about-dialog.html">
Read more of this post &raquo;
</a></p>
</div>
</article>
<article>
<header>
<h2>
<a href="https://www.eclipse.org/rcptt/blog/2014/11/21/screenshots-with-rcptt.html"> Screenshots for documentation</a>
<small>Nov, 21, 2014 by Ivan Inozemtsev</small> </h2>
</header>
<div>
<p>
This year on EclipseCon Europe Jeremie Bresson pointed me to a <a href="http://model-driven-blogging.blogspot.ru/2009/03/shuangxi-effect-ui-testing-and.html">nice C├ędric Brun's article</a> on how to use SWTBot to generate screenshots for documentation, and asked whether something like this is possible with RCPTT.
</p>
<p>
And the answer is &ndash; yes, indeed! Actually, I never thought about this use-case before, but we have a <a href="http://download.eclipse.org/rcptt/release/1.5.4/doc/ecl/index.html#save-screenshot">save-screenshot</a> command, which can save a screenshot of a control into a file. So, here's how to save screenshots for new plugin project wizard:
</p>
<pre data-line="5,10,14,20"><code class="language-ecl">&#x200b;get-view "Package Explorer" | get-tree | get-menu "New/Plug-in Project" | click
with [get-window "New Plug-in Project"] {
get-editbox -after [get-label "Project name:"] | set-text "org.sample.view"
get-object | save-screenshot "/tmp/tmp/demo/first-page.png"
get-button "Next >" | click
get-group Properties | get-editbox -after [get-label "Name:"]
| set-text "Sample View Plugin"
get-object | save-screenshot "/tmp/tmp/demo/second-page.png"
get-button "Next >" | click
get-table | select "Plug-in with a view"
get-object | save-screenshot "/tmp/tmp/demo/third-page.png"
get-button "Next >" | click
}
with [get-window "New plug-in project with a sample view"] {
get-button "Tree viewer" | click
get-object | save-screenshot "/tmp/tmp/demo/fourth-page.png"
get-button Finish | click
}
</code></pre>
<p>
This is just a recorded test case with manual insertion of <code class="language-ecl">&#x200b;get-object | save-screenshot &quot;/path/to/screenshot.png&quot;</code> snippets in interesting parts. Here <code class="language-ecl">&#x200b;get-object</code> takes an SWT object from RCPTT selector command (since we are in <code class="language-ecl">&#x200b;with</code> block, we are taking an SWT object from a window here), and <code class="language-ecl">&#x200b;save-screenshot</code> takes bounds of given control and saves a screenshot to given path. Here are the images, saved as an execution result of the script above:
</p>
<p><a href="https://www.eclipse.org/rcptt/blog/2014/11/21/screenshots-with-rcptt.html">
Read more of this post &raquo;
</a></p>
</div>
</article>
<article>
<header>
<h2>
<a href="https://www.eclipse.org/rcptt/blog/2014/11/11/rcptt-blog-launched.html"> RCPTT Blog launched</a>
<small>Nov, 11, 2014 by Ivan Inozemtsev</small> </h2>
</header>
<div>
<p>Finally we've launched an RCPTT blog! We published a few older articles here, so that this blog wouldn't look too empty :).</p>
<p>Oh, and by the way, if you haven't noticed yet, now we've got a nice syntax colorer for ECL snippets (thanks to an awesome <a href="http://prismjs.com">prism.js</a> library):</p>
<p></p>
<pre ><code class="language-ecl">&#x200b;proc "find-tab-folder" [val activePage] {
loop [val index [int 0]] {
let [val folder [get-tab-folder -index $index]] {
let [val folderActivePage [$folder | get-property activePage -raw]] {
if [$folderActivePage | eq $activePage] {
$folder //returning result
} -else {
recur [$index | plus 1]
}
}
}
}
}
find-tab-folder "Task List" | get-object | save-screenshot "/tmp/tmp/tsk.png"
//get-property activePage | equals "Package Explorer" | verify-true
</code></pre>
<p>Things like rss/atom feeds and improved navigation are to be added in a nearest future.</p>
<p>Stay tuned!</p>
</div>
</article>
<article>
<header>
<h2>
<a href="https://www.eclipse.org/rcptt/blog/2014/10/23/1_5_3-released.html"> RCPTT 1.5.3 Released</a>
<small>Oct, 23, 2014 by Ivan Inozemtsev</small> </h2>
</header>
<div>
<p>On October, 23, we released a new bugfix version of RCP Testing Tool. The complete list of fixed issues is savailable on <a href="https://projects.eclipse.org/projects/technology.rcptt/releases/1.5.3/bugs">1.5.3 release page</a>, and the latest version can be downloaded from <a href="https://www.eclipse.org/rcptt/download">Downloads</a> page. In this topic I would like to outline a couple of my favourite improvements.</p>
<h3 id="encryption-of-password-fields-during-recording-%28%7B%7Bm.bugzilla%28%22436965%22%29%7D%7D%29">Encryption of password fields during recording (<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=436965">#436965</a>)</h3>
<p>Now, if you type a password in a password field during recording, for example in a dialog like this</p>
<p><img src="https://www.eclipse.org/rcptt/shared/img/blog/1.5.3/passwords.png"/></p>
<p>Then recorded script would look like this:</p>
<p></p>
<pre data-line="5"><code class="language-ecl">&#x200b;with [get-window Preferences] {
with [get-window "Edit Proxy Entry"] {
get-editbox -after [get-label "User:"] | set-text ooo
get-editbox -after [get-label "Password:"]
| set-text [decrypt "Gd3oJsWozfDNuJuSAmjCmw=="] // !! &lt;--- decrypt
}
}
</code></pre>
<p><br/></p>
<p>So, the script does not store entered text directly, instead it records encrypted string as an argument to a special <code class="language-ecl">&#x200b;decrypt</code> command. During test case execution, this string is being decrypted and set into text field.</p>
<p><a href="https://www.eclipse.org/rcptt/blog/2014/10/23/1_5_3-released.html">
Read more of this post &raquo;
</a></p>
</div>
</article>
<article>
<header>
<h2>
<a href="https://www.eclipse.org/rcptt/blog/2014/09/19/regression-testing.html"> Regression Testing with RCP Testing Tool</a>
<small>Sep, 19, 2014 by Ivan Inozemtsev</small> </h2>
</header>
<div>
<p></p>
<p>This article is a shortened version of an article published for Eclipse Community newsletter (<a href="http://www.eclipse.org/community/eclipse_newsletter/2014/september/article3.php">September 2014</a>), and it demonstrates how to create UI tests with RCP Testing Tool. Existing Eclipse bugs from Eclipse bugzilla were used as scenarios for test cases. If you are not familiar with RCPTT, please check out our <a href="http://eclipse.org/rcptt">main page</a> and <a href="https://www.eclipse.org/rcptt/documentation/userguide/getstarted">Get Started</a> guide.</p>
<h3 id="preparing-test-development-environment">Preparing test development environment</h3>
<p>This is straightforward process and takes less than 10 minutes:</p>
<ol>
<li><a href="http://eclipse.org/rcptt/download">Download</a>, unpack, and launch RCPTT.</li>
<li>In a context menu of <span class="uiElement"> <img src="https://www.eclipse.org/rcptt/shared/img/ui-workspace.gif"></img> Test Explorer</span>
view select <span class="uiElement">New &#8594; <img src="https://www.eclipse.org/rcptt/shared/img/ui-rcptt-project.png"/> RCP Testing Tool Project</span>.</li>
<li>In a context menu of <span class="uiElement"> <img src="https://www.eclipse.org/rcptt/shared/img/ui-applications.gif"></img> Applications</span>
view select <span class="uiElement"><img src="https://www.eclipse.org/rcptt/shared/img/ui-new-aut.gif"/> New&#8230;</span> and browse for an application-under-test (I'm going to use Eclipse Luna).</li></li>
<li>Once you add an application-under-test, double-click it in <span class="uiElement"> <img src="https://www.eclipse.org/rcptt/shared/img/ui-applications.gif"></img> Applications</span>
view to launch.</li>
</ol>
<p>The final setup should look like this:</p>
<p><a href="https://www.eclipse.org/rcptt/shared/img/blog/regression/init.png"><img src="https://www.eclipse.org/rcptt/shared/img/blog/regression/init.png" width="600"/></a></p>
<p>That's it. Now you are ready to go. The general workflow for test case design looks like this:</p>
<ol>
<li>Describe an initial state using contexts.</li>
<li>Create a test case with required context references.</li>
<li>Record actions and assertions.</li>
<li>Modify recorded script if necessary.</li>
</ol>
<p>Now, let's design our first test case.
<p><a href="https://www.eclipse.org/rcptt/blog/2014/09/19/regression-testing.html">
Read more of this post &raquo;
</a></p>
</div>
</article>
<nav>
<br />
<a href="https://www.eclipse.org/rcptt/blog/page/2/">Older Posts</a><br />
</nav>
</div>
</section>
<script src="https://www.eclipse.org/rcptt/shared/js/main.js"></script>
</body>