Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pyenvjasmine/tests/test_runner.py

    r36 r33  
    55
    66
    7 class TestsRunnerRhino(object):
    8 
    9     """
    10     Run the full tests using the old rhino+jasmine1 env
    11     """
     7class TestsRunner(object):
    128
    139    def test_runner_defaults(self):
     
    1511        Test the runner, using default values (which wil run the demo specs)
    1612        """
    17         jstests = Runner(testing_enviroment='rhino')
     13        jstests = Runner()
    1814        success, stdout = jstests.run()
    1915        assert success
     
    3026        envjasmine_dir = os.path.join(os.path.dirname(here), 'envjasmine')
    3127        jstests = Runner(
    32             testing_enviroment='rhino',
    3328            rootdir=envjasmine_dir,
    3429            testdir=sample,
     
    5247        envjasmine_dir = os.path.join(os.path.dirname(here), 'envjasmine')
    5348        jstests = Runner(
    54             testing_enviroment='rhino',
    5549            rootdir=envjasmine_dir,
    5650            testdir=sample,
     
    7468        envjasmine_dir = os.path.join(os.path.dirname(here), 'envjasmine')
    7569        jstests = Runner(
    76             testing_enviroment='rhino',
    7770            rootdir=envjasmine_dir,
    7871            testdir=sample,
     
    10497        # but we want to test also the case when a test failed
    10598        # and it does not appear in the "Failed:" report
    106         jstests = Runner(testing_enviroment='rhino')
     99        jstests = Runner()
    107100        success = jstests.did_test_pass('')
    108101        assert not success
     
    127120        success = jstests.did_test_pass('Failed: something-not-a-number')
    128121        assert not success
    129 
    130 class TestsRunnerPhantomjs(object):
    131 
    132     """
    133     Run the full tests using the phantom+jasmine3 env
    134     """
    135 
    136     def test_write_browser_htmlfile_markup_is_correct(self):
    137         """
    138         Test the created markup
    139         The config file doesn't contain the mock files so jasmine tests
    140         are expected to fail
    141         """
    142         here = os.path.dirname(__file__)
    143         sample = os.path.join(here, 'sample')
    144         browser_conf_file = os.path.join(sample, 'browser.configfile_no_mocks.js')
    145         envjasmine_dir = os.path.join(os.path.dirname(here), 'envjasmine')
    146         jstests = Runner(
    147             testing_enviroment='phantomjs',
    148             rootdir=envjasmine_dir,
    149             testdir=sample,
    150             browser_configfile=browser_conf_file
    151         )
    152         expected = jstests.create_testRunnerHtml()
    153         jstests.write_browser_htmlfile()
    154         success, stdout = jstests.run()
    155         assert not success
    156         assert '2 test(s) FAILED:' in stdout
    157         with open("browser.runner.html",'r') as file:
    158             actual = file.read()
    159             assert expected == actual
    160 
    161     def test_runner_with_browser_configfile(self):
    162         """
    163         Test the runner, giving it some parameters incl the browser config file
    164         The config file contains the mock files so jasmine tests are expected
    165         to pass
    166         """
    167         here = os.path.dirname(__file__)
    168         sample = os.path.join(here, 'sample')
    169         browser_conf_file = os.path.join(sample, 'browser.configfile.js')
    170         envjasmine_dir = os.path.join(os.path.dirname(here), 'envjasmine')
    171         jstests = Runner(
    172             testing_enviroment='phantomjs',
    173             rootdir=envjasmine_dir,
    174             testdir=sample,
    175             browser_configfile=browser_conf_file
    176         )
    177         success, stdout = jstests.run()
    178         assert success
    179         assert '0 failures' in stdout
    180 
    181     def test_did_test_pass(self):
    182         # there is some coverage done with the previous tests,
    183         # but we want to test also the case when a test failed
    184         # and it does not appear in the "Failed:" report
    185         here = os.path.dirname(__file__)
    186         sample = os.path.join(here, 'sample')
    187         browser_conf_file = os.path.join(sample, 'browser.configfile.js')
    188 
    189         jstests = Runner(
    190             testing_enviroment='phantomjs',
    191             browser_configfile=browser_conf_file
    192         )
    193         success = jstests.did_test_pass('')
    194         assert not success
    195         success = jstests.did_test_pass('some random data '*50)
    196         assert not success
    197         success = jstests.did_test_pass('some data FAILED some more data')
    198         assert not success
    199         success = jstests.did_test_pass('some data FAILEDsome more data')
    200         assert not success
    201         success = jstests.did_test_pass('0 failures')
    202         assert success
    203         success = jstests.did_test_pass('0 failures FAILED')
    204         assert not success
    205         success = jstests.did_test_pass('0Failed: failures')
    206         assert not success
    207         success = jstests.did_test_pass('1 test(s) FAILED:')
    208         assert not success
    209         success = jstests.did_test_pass('-11 test(s) FAILED:')
    210         assert not success
    211         success = jstests.did_test_pass('something-not-a-number test(s) FAILED:')
    212         assert not success
Note: See TracChangeset for help on using the changeset viewer.