EAddress Class Library
EAddress generates a string of random Unicode characters in the ASCII range of U+0020 through U+007E for testing the local address component of an email address (the local address is the string the precedes the @ character in an email address). EAddress will generate a string between 4 and 64 characters in length (the maximum length of a local address). Characters that are invalid in the local address are dependent on the domain or provider, and can be excluded by specifying them in the InvalidCharacterSet property.
IMPORTANT: The validity of the randomly generated local address string depends on your ability as a tester to correctly identify the equivalent partition of invalid characters for the specific domain being tested.EAddress doesn't generate a string designed to test all invalid permutations of the period character. To test proper handling of a local address string parsing algorithm you can also modify the output of a valid string so:
- the first character in the test data string is a period (.) character
- the last character in the test data string is a period (..) character
- 2 consecutive period (.) characters are randomly inserted into the test data string
- a commercial at (@) character is randomly inserted in the test data string
Of course these permutations could also be tested with invalid strings containing invalid characters for more robust test coverage; however it is likely an exception will be thrown on the first invalid character in the string.
Click Here to Download the EAddress Test Automation Library
EAddress 1.0 Members
Generates a random Unicode string based on parameterized equivalent partitions.
Constructor
| Name | Description | |
|
|
EmailAddressGenerator | Initializes a new instance of the EmailAddressGenerator class |
Methods
| Name | Description | |
|
|
GetLocalAddress | Generates a random string of ASCII characters parameterized by the EmailAddressInfo information |
Properties
| Name | Description | |
|
|
EmailAddressInfo | Sets the properties to pass to the ArtificialAddress method of the EmailAddressGenerator |
Remarks
If the IsValidAddress property set to true EAddress will generate a string of characters that exclude the characters in the InvalidCharacterSet.
If the IsValidAddress property set to false EAddress will generate a string of characters that contains at least one character contained in the InvalidCharacterSet.
If the AddressMaxLength property is greater than 64 or less than 4 the AddressMaxLength property will default to 64 characters.
If the AddressMinLength property is greater than 64 or less than 4 the AddressMinLength property will default to 4 characters.
Exceptions
ArgumentException
An ArgumentException will be thrown if the LocalAddressMinLength value is greater than the LocalAddressMaxLength value.
Example
| using System; using TestingMentor.TestTool.EAddress; namespace RandomTestDataGeneratorExample { class RandomLocalEmailAddress { static void Main() { // Generate a random seed value for the pseudo-random // generator Random r = new Random(); int seedValue = r.Next(); // Log seedValue variable to be able to regenerate identical // string EmailAddressGenerator eag = new EmailAddressGenerator (); eag.Info.SeedValue = seedValue; eag.Info.IsRandomLength = true; string testData = eag.GetLocalAddress(); } } } |
This example returns a string of randomly generated ASCII characters with a character count between 4 and 64 ASCII characters between U+0021 and U+007E.
Example
| using System; using TestingMentor.TestTool.EAddress; namespace RandomTestDataGeneratorExample { class RandomLocalEmailAddress { static void Main() { // Generate a random seed value for the pseudo-random // generator Random r = new Random(); int seedValue = r.Next(); // Log seedValue variable to be able to regenerate identical // string EmailAddressGenerator eag = new EmailAddressGenerator (); eag.Info.SeedValue = seedValue; eag.Info.IsValidAddress = true; eag.Info.AddressMaxLength = 32; eag.Info.RandomizeLength = false; eag.Info.InvalidCharacterSet = { '!', '#', '$', '%', '^', '&', '*', '-', '_', '{', '}', '|', '/' '?' }; string testData = eag.GetLocalAddress(); } } } |
This example returns a string of randomly generated ASCII characters with a character count of 32 characters, and excludes the specified characters in the character array.
Example
| using System; using TestingMentor.TestTool.EAddress; namespace RandomTestDataGeneratorExample { class RandomLocalEmailAddress { static void Main() { // Generate a random seed value for the pseudo-random // generator Random r = new Random(); int seedValue = r.Next(); // Log seedValue variable to be able to regenerate identical // string EmailAddressGenerator eag = new EmailAddressGenerator (); eag.Info.SeedValue = seedValue; eag.Info.AddressMaxLength = 32; eag.Info.RandomizeLength = true; eag.Info.InvalidCharacterSet = { '!', '#', '$', '%', '^', '&', '*', '-', '_', '{', '}', '|', '/' '?' }; string testData = eag.GetLoalAddress(); } } } |
This example returns a string of randomly generated ASCII characters with a random character count between 4 and 32 characters, and includes at least one character from the InvalidCharacterSet.





