Closed zhou777 closed 8 years ago
Are you saving the JSON before it is executed? Can you provide a code snippet for me to reproduce the issue?
Are you saving the JSON before it is executed? when the testCase is finished,then I save the JSON file(self.report()).
Can you provide a code snippet for me to reproduce the issue? sorry,Because it involves ISMS, I can't provide JS code. At before, is there a similar problem?
code snippet of testCase : (testCase by selenium2 + python)
def test_login_logout_push(self):
driver = self.driver
driver.get(self.base_url + "/")
time.sleep(2)
driver.find_element_by_id("login").click()
element = driver.find_element_by_id("loginButton").is_displayed()
self.assertTrue(element)
driver.find_element_by_id("Password").clear()
driver.find_element_by_id("Password").send_keys("admin")
driver.find_element_by_id("loginButton").click()
time.sleep(2)
driver.find_element_by_id("login").click()
time.sleep(2)
self.report()
driver.close()
def report(self):
coverageJSON = self.driver.execute_script("return jscoverage_serializeCoverageToJSON();")
file = open("C:/src/jscoverage.json","w")
file.write(coverageJSON)
file.close()
No, I haven't seen this before. I suspect it's a timing issue, or the code is executed in another context. Have you tried with --local-storage
?
I only used cookie,did not used html5's local storage.
Can you trying the file instrumentation with --local-storage
and see if the result is the same?
1)a part of instrumented code: ... $jscoverage['///*.js'].lineData[54]++; alert($jscoverage['///.js'].lineData[54]); data.getIndexHTML(); $jscoverage['///_.js'].lineData[55]++; cookie.setCookie("isLogin", "false"); ... 2)json data "lineData":...,0,0...
when I run the test case by chrome,(alert($jscoverage['//_/*.js'].lineData[54]);) was executed, And the result is 1. why can not be reflected to the JSON file?
※Only a part of the code in a file will have this problem.