Feeds:
Posts
Comments

Archive for the ‘TestDrivenDevelopment’ Category

Start with test

As a TDD believer, my “HelloWorld” starts with test. Following has puzzled me for quite some time:

When using TestNG, I see @BeforeSuite, @BeforeTest, @BeforeClass, @BeforeGroups, @BeforeMethod. What’s their relationship to each other? Particularly, what’s the difference between @BeforeTest and @BeforeClass?

It’s not so easy to find answer for such trivial question. I search through TestNG documents and forums, no luck.

Then I come back to the basics — if I don’t understand something, it’s always BASICS.

What are suite, test, class, groups, method defined in TestNG anyway?

  • Method: smallest test unit
  • Groups: you can group multiple methods into one group. (Can group cross classes? ToBeTested, my guess is true)
  • Class: a test class which defines test methods
  • Test: you can define it by a set of classes, packages, or groups
  • Suite: a collection of Tests

Now you know what’s @BeforeSuite, @BeforeTest, @BeforeClass, @BeforeGroups, @BeforeMethod, don’t you?

Read Full Post »