NetBeans IDE 7.2 引入了 TestNG

  • Code Generation Advantage: It allows seeing how a specific language feature or framework is used. In the case of NetBeans 7.2 beta, it provides TestNG integration.
  • New File Wizard in NetBeans 7.2: Makes it easier to create an empty TestNG test case. Screenshots show the process of using "New File | Unit Tests" under the "File" drop-down menu or by right-clicking in the Projects window.
  • Generated Test Code: By running the TestNG test case creation, the following code is generated in TestNGDemo.java. It includes comments on adding and annotating test methods, similar to modern JUnit versions. It also shows some annotations for overall and per-test setup and tear down. Unused import statements are identified but included.
  • Adding a Test Method: An example test method using TestNG is added easily. It tests integer arithmetic multiplication and uses assertEquals.
  • TestNG Output in NetBeans 7.2: Screenshot shows the output when right-clicking on the test case class and selecting "Run File" (Shift+F6). The text output of the TestNG run is reproduced, including details of each test step and the final summary.
  • Conclusion: The example shows how easy it is to start using TestNG with NetBeans 7.2 beta, especially for those moving from JUnit. While TestNG has more features, NetBeans 7.2 helps get one started quickly.
阅读 7
0 条评论