/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to doc/developers/testing.txt

  • Committer: Robert Collins
  • Date: 2010-05-06 11:08:10 UTC
  • mto: This revision was merged to the branch mainline in revision 5223.
  • Revision ID: robertc@robertcollins.net-20100506110810-h3j07fh5gmw54s25
Cleaner matcher matching revised unlocking protocol.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
The Importance of Testing
7
7
=========================
8
8
 
9
 
Reliability is a critical success factor for any version control system.
 
9
Reliability is a critical success factor for any Version Control System.
10
10
We want Bazaar to be highly reliable across multiple platforms while
11
11
evolving over time to meet the needs of its community.
12
12
 
183
183
 
184
184
.. _testrepository: https://launchpad.net/testrepository
185
185
 
186
 
 
187
 
Babune continuous integration
188
 
-----------------------------
189
 
 
190
 
We have a Hudson continuous-integration system that automatically runs 
191
 
tests across various platforms.  In the future we plan to add more 
192
 
combinations including testing plugins.  See 
193
 
<http://babune.ladeuil.net:24842/>.  (Babune = Bazaar Buildbot Network.)
194
 
 
195
 
 
196
186
Writing Tests
197
187
=============
198
188
 
395
385
The actual use of ScriptRunner within a TestCase looks something like
396
386
this::
397
387
 
398
 
    from bzrlib.tests import script
399
 
 
400
 
    def test_unshelve_keep(self):
401
 
        # some setup here
402
 
        script.run_script(self, '''
403
 
            $ bzr add file
404
 
            $ bzr shelve --all -m Foo
405
 
            $ bzr shelve --list
406
 
            1: Foo
407
 
            $ bzr unshelve --keep
408
 
            $ bzr shelve --list
409
 
            1: Foo
410
 
            $ cat file
411
 
            contents of file
412
 
            ''')
 
388
        def test_unshelve_keep(self):
 
389
                # some setup here
 
390
                sr = ScriptRunner()
 
391
                sr.run_script(self, '''
 
392
        $ bzr add file
 
393
        $ bzr shelve --all -m Foo
 
394
        $ bzr shelve --list
 
395
        1: Foo
 
396
        $ bzr unshelve --keep
 
397
        $ bzr shelve --list
 
398
        1: Foo
 
399
        $ cat file
 
400
        contents of file
 
401
        ''')
413
402
 
414
403
 
415
404
Import tariff tests
431
420
  dependencies and only needed for particular cases.  If they're loaded in
432
421
  other cases then bzr may break for people who don't have those modules.
433
422
  
434
 
`test_import_tariff` allows us to check that removal of imports doesn't
 
423
`test_import_tarrif` allows us to check that removal of imports doesn't
435
424
regress.
436
425
 
437
426
This is done by running the command in a subprocess with
783
772
 
784
773
TestCase
785
774
    A base TestCase that extends the Python standard library's
786
 
    TestCase in several ways.  TestCase is build on
787
 
    ``testtools.TestCase``, which gives it support for more assertion
788
 
    methods (e.g.  ``assertContainsRe``), ``addCleanup``, and other
789
 
    features (see its API docs for details).  It also has a ``setUp`` that
790
 
    makes sure that global state like registered hooks and loggers won't
791
 
    interfere with your test.  All tests should use this base class
792
 
    (whether directly or via a subclass).  Note that we are trying not to
793
 
    add more assertions at this point, and instead to build up a library
794
 
    of ``bzrlib.tests.matchers``.
 
775
    TestCase in several ways.  It adds more assertion methods (e.g.
 
776
    ``assertContainsRe``), ``addCleanup``, and other features (see its API
 
777
    docs for details).  It also has a ``setUp`` that makes sure that
 
778
    global state like registered hooks and loggers won't interfere with
 
779
    your test.  All tests should use this base class (whether directly or
 
780
    via a subclass).
795
781
 
796
782
TestCaseWithMemoryTransport
797
783
    Extends TestCase and adds methods like ``get_transport``,
873
859
.. |--| unicode:: U+2014
874
860
 
875
861
..
876
 
   vim: ft=rst tw=74 ai et sw=4
 
862
   vim: ft=rst tw=74 ai