1、 Error information
E:\pythonProject\study\venv\Scripts\python.exe E:/pythonProject/case/test_ login.py
…Traceback (most recent call last):
File “E:\pythonProject\case\test_ login.py”, line 71, in < module>
runner.run(suit) # Call the run() method under the htmltestrunner class to run the use case suite
class File “E:\pythonProject\study\venv\lib\site-packages\HTMLTestRunner\HTMLTestRunner.py”, line 631, in run
self.generateReport(test, result)
File “E:\pythonProject\study\venv\lib\site-packages\HTMLTestRunner\HTMLTestRunner.py”, line 691, in generateReport
self.stream.write(output)
TypeError: a bytes-like object is required, not ‘str’
2、 Source code
#Path and name of test report
dir = “E:/pythonProject/login_ report.html”
#”WB” creates or opens a binary file and writes the finished data
filename = open(dir, “wb”)
#Call htmltestrunner class to define test report content
runner = HTMLTestRunner.HTMLTestRunner(stream=filename, title=”Testcase Report”, description=”testcases”)
runner.run(suit) # Call the run () method under the htmltestrunner class to run the use case suite
filename.close() # Close test report file
3、 Solutions
#Path and name of test report
dir = “E:/pythonProject/login_ report.html”
#”W” creates or opens a new file and writes the finished data
filename = open(dir, “w”)
#Call htmltestrunner class to define test report content
runner = HTMLTestRunner.HTMLTestRunner(stream=filename, title=”Testcase Report”, description=”testcases”)
runner.run(suit) # Call the run () method under the htmltestrunner class to run the use case suite
filename.close() # Close test report file
Read More:
- Httprunner v3. X generates HTML report in assure format
- Troubleshooting of Jenkins upgrade to 2.42 JUnit test report
- Clion configuration MingGW report error test cmake run with errors solution
- Causes and solutions of nm test o file format not recognized
- In Python, import XXX does not report an error, but in IPython (Jupiter notebook)
- Anaconda opens Navigator to report an error and a web page appears Navigator Error An unexpected error occurred on Navigator start-up Report
- Solution of connection error report in MySQL installation
- After JQ gets the tag element itself, it gets its own HTML text format (find only finds one level of child elements)
- Solution of spring auto injection always report error in IntelliJ idea
- Error report when installing arpspoof in Kali
- Error report on & written by latex in overleaf
- Node.js Using port 80 to report errors in Linux
- Error report and solution of import panda in Windows 10
- Error report of. XML header file constraint in idea
- Solution of error report in springboot Maven package websocket
- Add a warehouse in allprojects repositories and report an error
- Use less.js to verify and report an error in the Vue file of vscode
- The solution of using Autowired annotation to report errors in IntelliJ idea
- Maven project pom.xml The solution of error report in execution of
- Report error when using microwave “must either be declared abstract” abstract method “getWXPayDomain()” in WXPayConfig