Skip to main content
deleted 10 characters in body
Source Link
Peter
  • 10k
  • 2
  • 35
  • 46

This is mostly a comment, but unfortunately too long to post it as such.

Related: How can I unit test a GUI?How can I unit test a GUI?

If your test requires you to create a Window, it's not a Unit Test. It might be a useful test, but it's not a Unit Test.

You test your classes by designing them such that if they logically don't require a Window, they don't rely on a Window. You also design classes such that very few of them logically require a Window.

To address your specific example, the example also seems to involve disk access, which is something some (but not all) people put in the same category as creating a Window. The condition of the test is also too little to be of actual use, and the naming of the test isn't at all descriptive, so I'll assume you're somewhat new to Unit Tests. I'll recommend to borrow some books on the topic from a local library, because web articles are too short to properly cover the topic, in my opinion.

This is mostly a comment, but unfortunately too long to post it as such.

Related: How can I unit test a GUI?

If your test requires you to create a Window, it's not a Unit Test. It might be a useful test, but it's not a Unit Test.

You test your classes by designing them such that if they logically don't require a Window, they don't rely on a Window. You also design classes such that very few of them logically require a Window.

To address your specific example, the example also seems to involve disk access, which is something some (but not all) people put in the same category as creating a Window. The condition of the test is also too little to be of actual use, and the naming of the test isn't at all descriptive, so I'll assume you're somewhat new to Unit Tests. I'll recommend to borrow some books on the topic from a local library, because web articles are too short to properly cover the topic, in my opinion.

This is mostly a comment, but unfortunately too long to post it as such.

Related: How can I unit test a GUI?

If your test requires you to create a Window, it's not a Unit Test. It might be a useful test, but it's not a Unit Test.

You test your classes by designing them such that if they logically don't require a Window, they don't rely on a Window. You also design classes such that very few of them logically require a Window.

To address your specific example, the example also seems to involve disk access, which is something some (but not all) people put in the same category as creating a Window. The condition of the test is also too little to be of actual use, and the naming of the test isn't at all descriptive, so I'll assume you're somewhat new to Unit Tests. I'll recommend to borrow some books on the topic from a local library, because web articles are too short to properly cover the topic, in my opinion.

Source Link
Peter
  • 10k
  • 2
  • 35
  • 46

This is mostly a comment, but unfortunately too long to post it as such.

Related: How can I unit test a GUI?

If your test requires you to create a Window, it's not a Unit Test. It might be a useful test, but it's not a Unit Test.

You test your classes by designing them such that if they logically don't require a Window, they don't rely on a Window. You also design classes such that very few of them logically require a Window.

To address your specific example, the example also seems to involve disk access, which is something some (but not all) people put in the same category as creating a Window. The condition of the test is also too little to be of actual use, and the naming of the test isn't at all descriptive, so I'll assume you're somewhat new to Unit Tests. I'll recommend to borrow some books on the topic from a local library, because web articles are too short to properly cover the topic, in my opinion.