List of mock valid/invalid Email Addresses for Unit Tests

北城以北 提交于 2019-12-09 04:16:28

问题


Does anyone know of a list of email addresses (which don’t need to be real) I can use for an email validation assembly for a unit test?

I’ve been looking for such a list and can’t seem to find one. I’m not looking for real addresses, just ones that fit, and the more things I can throw at the test the better. I’ve got 10 right now, but if there is a list, it would give me a more thorough test.


回答1:


I believe you were looking for something like this:

List of Valid and Invalid Email Addresses




回答2:


Check the tests of the Apache Commons EmailValidator class:

  • EmailTest,
  • EmailValidatorTest.

The EmailValidatorTest in the Hibernate Validator also contains some address.




回答3:


I like to use the set in this page on email validating regexes because the addresses contain what they're testing inside the email address.




回答4:


Here is a set of test emails that Dominic Sayers uses to test his isEmail validator:

http://code.iamcal.com/php/rfc822/tests/

For more on isEmail:

http://isemail.info/about



来源:https://stackoverflow.com/questions/7641019/list-of-mock-valid-invalid-email-addresses-for-unit-tests

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!