Changeset 36:4c964b691922 in pyenvjasmine for pyenvjasmine/tests
- Timestamp:
- Mar 23, 2018, 9:09:29 AM (6 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- pyenvjasmine/tests
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pyenvjasmine/tests/sample/browser.configfile.js
r0 r36 6 6 EnvJasmine.jsDir = EnvJasmine.testDir + "/code/"; 7 7 EnvJasmine.loadGlobal(EnvJasmine.includeDir + "jquery-1.4.4.js"); 8 EnvJasmine.loadGlobal(EnvJasmine.testDir + '/code/demo.js'); 9 EnvJasmine.loadGlobal(EnvJasmine.testDir + '/mocks/demo.mock.js'); 10 EnvJasmine.loadGlobal(EnvJasmine.testDir + '/tests/specs/test_demo.spec.js'); -
pyenvjasmine/tests/test_runner.py
r33 r36 5 5 6 6 7 class TestsRunner(object): 7 class TestsRunnerRhino(object): 8 9 """ 10 Run the full tests using the old rhino+jasmine1 env 11 """ 8 12 9 13 def test_runner_defaults(self): … … 11 15 Test the runner, using default values (which wil run the demo specs) 12 16 """ 13 jstests = Runner( )17 jstests = Runner(testing_enviroment='rhino') 14 18 success, stdout = jstests.run() 15 19 assert success … … 26 30 envjasmine_dir = os.path.join(os.path.dirname(here), 'envjasmine') 27 31 jstests = Runner( 32 testing_enviroment='rhino', 28 33 rootdir=envjasmine_dir, 29 34 testdir=sample, … … 47 52 envjasmine_dir = os.path.join(os.path.dirname(here), 'envjasmine') 48 53 jstests = Runner( 54 testing_enviroment='rhino', 49 55 rootdir=envjasmine_dir, 50 56 testdir=sample, … … 68 74 envjasmine_dir = os.path.join(os.path.dirname(here), 'envjasmine') 69 75 jstests = Runner( 76 testing_enviroment='rhino', 70 77 rootdir=envjasmine_dir, 71 78 testdir=sample, … … 97 104 # but we want to test also the case when a test failed 98 105 # and it does not appear in the "Failed:" report 99 jstests = Runner( )106 jstests = Runner(testing_enviroment='rhino') 100 107 success = jstests.did_test_pass('') 101 108 assert not success … … 120 127 success = jstests.did_test_pass('Failed: something-not-a-number') 121 128 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.