{"id":812,"date":"2023-03-01T06:49:04","date_gmt":"2023-02-28T22:49:04","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=812"},"modified":"2023-04-05T17:31:49","modified_gmt":"2023-04-05T09:31:49","slug":"testng-multi-threaded-and-common-asserts","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/01\/testng-multi-threaded-and-common-asserts\/","title":{"rendered":"TestNG\u591a\u7ebf\u7a0b\u8fd0\u884c\u53ca\u5e38\u7528\u65ad\u8a00"},"content":{"rendered":"<h2>\u591a\u7ebf\u7a0b\u8fd0\u884c<\/h2>\n<pre><code class=\"language-java\">@Test(invocationCount = 10\uff0cthreadPoolSize = 3, timeout = 3000)<\/code><\/pre>\n<p><!-- more --><\/p>\n<ul>\n<li>invocationCount\uff1a\u8868\u793a\u6267\u884c\u7684\u6b21\u6570 <\/li>\n<li>threadPoolSize\uff1a\u8868\u793a\u7ebf\u7a0b\u6c60\u7684\u5185\u7ebf\u7a0b\u7684\u4e2a\u6570 <\/li>\n<li>timeOut\uff1a\u8d85\u65f6\u65f6\u95f4-\u6beb\u79d2<\/li>\n<\/ul>\n<h2>\u5e38\u7528\u65ad\u8a00<\/h2>\n<p>\u5bfc\u5165Assert\u5305\uff1a<\/p>\n<pre><code class=\"language-java\">import static org.testng.Assert.*;<\/code><\/pre>\n<ul>\n<li>(1) assertTrue\uff1a\u5224\u65ad\u662f\u5426\u4e3aTrue<\/li>\n<li>(2) assertFalse\uff1a\u5224\u65ad\u662f\u5426\u4e3afalse<\/li>\n<li>(3) assertSame\uff1a\u5224\u65ad\u5f15\u7528\u5730\u5740\u662f\u5426\u76f8\u540c<\/li>\n<li>(4) assertNotSame\uff1a\u5224\u65ad\u5f15\u7528\u5730\u5740\u662f\u5426\u4e0d\u76f8\u540c<\/li>\n<li>(5) assertNull\uff1a\u5224\u65ad\u662f\u5426\u4e3anull<\/li>\n<li>(6) assertNotNull\uff1a\u5224\u65ad\u662f\u5426\u4e0d\u4e3anull<\/li>\n<li>(7) assertEquals\uff1a\u5224\u65ad\u662f\u5426\u76f8\u7b49\uff0cObject\u7c7b\u578b\u7684\u5bf9\u8c61\u9700\u8981\u5b9e\u73b0haseCode\u53caequals\u65b9\u6cd5<\/li>\n<li>(8) assertNotEquals\uff1a\u5224\u65ad\u662f\u5426\u4e0d\u76f8\u7b49<\/li>\n<li>(9) assertEqualsNoOrder\uff1a\u5224\u65ad\u5ffd\u7565\u987a\u5e8f\u662f\u5426\u76f8\u7b49<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u591a\u7ebf\u7a0b\u8fd0\u884c @Test(invocationCount = 10\uff0cthreadPoolSize = 3, ti [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[224],"tags":[],"class_list":["post-812","post","type-post","status-publish","format-standard","hentry","category-testng"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/812","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=812"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/812\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=812"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=812"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=812"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}