<div dir="ltr">Very interesting, thanks for sharing.<div>Would be nice have this content in the wiki, for future reference.</div><div><br></div><div>Gonzalo</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Tue, Jan 7, 2014 at 12:02 PM, Sai Vineet <span dir="ltr"><<a href="mailto:saivineet89@gmail.com" target="_blank">saivineet89@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Recently, for the the task "Automated Activity Testing" in GCI, I made a basic Activity Test example and implemented a way to run them.<div><br></div><div>I wrote a basic UI test and a basic unit test for for Calculate, which can be seen in this merge request - <a href="http://git.sugarlabs.org/calculate/mainline/merge_requests/13" target="_blank">git.sugarlabs.org/calculate/mainline/merge_requests/13</a> </div>
<div><br></div><div>To write tests, a "tests" folder must be made inside the bundle path of your activity. Inside that directory, there can be a "unit" and a "integration" subfolders. The unit test folder is supposed to contain tests. The test files begin with "test_", so that modules you have made for convenience testing do not get executed uselessly. <br>
Similarly the integration test folder contains UI tests starting with "test_". <br>Python's inbuilt unittest module is used for unit tests and a extended version of unittest is used for UI tests.</div><div>
<br>
</div><div>These tests can be executed using ./setup.py check<br>setup.py also takes a optional argument of which set of tests to run - </div><div>./setup.py check integration</div><div>./setup.py check unit</div><div><br>
</div><div>The UI test is a bit hard to follow, so I ask you to look at the test examples in the Calculate commit I made above. <br>The sugar3.test.unittest module's UITestCase class is used for UI tests. This class has a context manager called run_activity, which starts the activity. There should be a bundle_id property set for the test case, which tells run_activity what bundle_id should be passed to sugar-launch for launching the activity.</div>
<div><br></div><div>I think this is all you need to get started writing tests for your activity.</div><div>And I would like to use this opportunity to thank Walter Bender. Thank you for mentoring us impatient sutdents. I know it was hard for you.</div>
<div><br></div><div>Thanks,<br>Sai Vineet.</div><div><br></div><div><br></div></div>
<br>_______________________________________________<br>
Sugar-devel mailing list<br>
<a href="mailto:Sugar-devel@lists.sugarlabs.org">Sugar-devel@lists.sugarlabs.org</a><br>
<a href="http://lists.sugarlabs.org/listinfo/sugar-devel" target="_blank">http://lists.sugarlabs.org/listinfo/sugar-devel</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Gonzalo Odiard<br><br><div>SugarLabs - Learning Software for children<br></div></div>
</div>