Often, I have foundters \ setsters, c'tors and object methods for making methods of the same unit test , And toString). With the help of Eclipse IDE, what I'm trying to achieve is the automation of this process. Consider this example:
public class person {Private string ID; The name of the private string; Public person (string id, string name) {this.id = id; This.name = name; } Public string getId () {return ID; } Public Zero Set ID (string id) {this.id = id; } Public string getName () {return name; } Public Zero Setname (string name) {this.name = name; } @ Override Public Entity Hashod () {...} Public Boolean equivalent (other person) {...} Public string toasting () {...} / * This class may apply other arguments which are irrelevant to this The unit test class will look something like this: PublicType PersonTest TestCase Extended {@ Override Public Zero Setup () { Person P1 = new person ("1", "Dave"); Person p2 = new person ("2", "David"); } @ Override Public Zero TierDown () {person p1 = null; Person p2 = null; } Public Zero TestGet ID () {p1.setId ("11"); AssertEquals ("wrong ID:", "11", p1.getId ()); } Public Zero testGetName () {/ * Above above * /} Public Zero Testing Equals_NotEquals () {/ * Verify that not equal to initial initial instances * /} Public Zero Testing Equals_Equals () {/ * Verify that a The object itself is equal to the public Zero Test HashCode_Valid () {/ * Verify that an object contains the same object as the same ashode / /} Public Zero Test HashCode_NotValid () {/ * Verify that the various objects The hash code in the code is different * * * Public void testToString () * Verify that all properties are present in the output * /}} This vast majority of skeletal-created sections Is it possible to be automated with eclipse?
View at a glance This is an eclipse plugin which provides a very good feature of the templateing stuff Looking for you. Look at the documentation page to create a unique test section.
A very useful feature of this plugin is to create unit testing automatically, the unit test type may be June 3, June 4, or TastingGG. For junior 4 or testgag tests, proper annotations will be automatically added. It needs to be configured only once
You may also get this.
Hope that helps.
Comments
Post a Comment