Your steps are wrong. Doing this this way will definitely help, 3, then 1, and then 2. Doing this way will make you think about functionality and units. And the result code will be tested without doing anything special. The test also first guides your system design beyond security.
PS Never try to write code before a test. It is simply not natural, and it does not attach much importance, as you can see.
Now, to check the 1st block, you can compare string , html with google.com with some existing string . But this test case will be broken if Google changes its page. Another way is to simply check the HTTP code from the header, if it's 200, you're fine. Just an idea.
For the second, you can compare the string that you are reading from a web page to the string that you wrote in the file by reading the file.
source share