~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to doc/developers/testing.txt

  • Committer: Martin Pool
  • Date: 2010-09-13 04:20:14 UTC
  • mto: (5416.1.7 ui-factory)
  • mto: This revision was merged to the branch mainline in revision 5422.
  • Revision ID: mbp@sourcefrog.net-20100913042014-9ia1c0b2cv8mxpyc
ScriptRunner can now cope with commands that prompt for input.

Show diffs side-by-side

added added

removed removed

Lines of Context:
446
446
            contents of file
447
447
            ''')
448
448
 
 
449
You can also test commands that read user interaction::
 
450
 
 
451
    def test_confirm_action(self):
 
452
        """You can write tests that demonstrate user confirmation"""
 
453
        commands.builtin_command_registry.register(cmd_test_confirm)
 
454
        self.addCleanup(commands.builtin_command_registry.remove, 'test-confirm')
 
455
        self.run_script("""
 
456
            $ bzr test-confirm
 
457
            2>Really do it? [y/n]: 
 
458
            <yes
 
459
            yes
 
460
            """)
449
461
 
450
462
Import tariff tests
451
463
-------------------