A shorter function name has many advantages. Think about what is really needed in your actual function name and what is already delivered.
test_that_client_event_listener_receives_connection_refused_error_without_server(self):
Do you already know this test when you run it? Do you really need to use underscores? are words like "that" really necessary to understand the name? would a camel case be equally readable? how about the first example below as rewriting above (number of characters = 79): Accepting an agreement to use abbreviations for a small collection of common words is even more efficient, for example. Connection = Conn, Error = Err. When using abbreviations, you should remember the context and use them only when there is no possibility of embarrassment - the second example below. If you agree that there is no actual need to mention the client as a test object in the method name, since this information is in the class name, then a third example may be appropriate. (54).
ClientEventListenerReceivesConnectionRefusedErrorWithoutServer (itself):
ClientEventListenerReceivesConnRefusedErrWithoutServer (itself):
EventListenerReceiveConnRefusedErrWithoutServer (itself):
I also agree with the suggestion from B Rad C "to use a descriptive name as msg kwarg arg in in self.assert". You should only be interested in seeing the result of failed tests when starting testuite. Verifying that you have all the necessary tests should not depend on the method names being so verbose.
PS Perhaps I will also remove "Serverless" as an extra. Should a client event handler receive an event if the server is not connected for any reason? (although tbh I would have thought that it would be better if the client could not connect to the server, it received some kind of “connection is unavailable”, the denial of connection suggests that the server can be found, but it refuses the connection itself.)
Charemer Dec 04 '16 at 13:22 2016-12-04 13:22
source share