[Sugar-devel] Automated Activity Tests
Gonzalo Odiard
godiard at sugarlabs.org
Tue Jan 7 10:14:08 EST 2014
Very interesting, thanks for sharing.
Would be nice have this content in the wiki, for future reference.
Gonzalo
On Tue, Jan 7, 2014 at 12:02 PM, Sai Vineet <saivineet89 at gmail.com> wrote:
> Recently, for the the task "Automated Activity Testing" in GCI, I made a
> basic Activity Test example and implemented a way to run them.
>
> I wrote a basic UI test and a basic unit test for for Calculate, which can
> be seen in this merge request -
> git.sugarlabs.org/calculate/mainline/merge_requests/13
>
> 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.
> Similarly the integration test folder contains UI tests starting with
> "test_".
> Python's inbuilt unittest module is used for unit tests and a extended
> version of unittest is used for UI tests.
>
> These tests can be executed using ./setup.py check
> setup.py also takes a optional argument of which set of tests to run -
> ./setup.py check integration
> ./setup.py check unit
>
> 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.
> 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.
>
> I think this is all you need to get started writing tests for your
> activity.
> 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.
>
> Thanks,
> Sai Vineet.
>
>
>
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>
>
--
Gonzalo Odiard
SugarLabs - Learning Software for children
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20140107/b27e8159/attachment.html>
More information about the Sugar-devel
mailing list