无法添加"它"内部阻挡"如果" Jasmine JS脚本中的语句

时间:2015-06-03 13:38:02

标签: javascript node.js selenium-webdriver jasmine protractor

我想操纵if语句为2个可能的动态情况,

但我也需要将我的"它"阻止我的HTML Reporter继续捕获当前屏幕。

所以我唯一可行的选择就是操纵if语句高于" it"块。

代码:

describe('LiveSite Portal - Existing client send new message', function() {

    var msgBtn = element(by.xpath("//div[@class='actions-row']//a[.='Leave Your Details']"));
    var EC = protractor.ExpectedConditions;

    it('LiveSite - Home Page', function() {
       liveSiteHome();
    });

    if (msgBtn.isPresent() === true) {

        it('LiveSite Portal - Existing client send new message - Message form', function() {
          browser.wait(EC.visibilityOf(msgBtn), 10000);
          element(msgBtn).click();
          waitPageToLoad(); 
          expect(element(by.id("new_client_message_message")).isPresent()).toBe(true);
          element(by.css("div.row.mandatory > div.area")).click();
          element(by.id("new_client_message_title")).sendKeys("Automation message");
          element(by.id("new_client_message_message")).sendKeys("I am not logged-in client. Please call me.");
          element(by.id("new_client_message_email")).sendKeys("idanvcita@gmail.com");
        });

        it('LiveSite Portal - Existing client send new message - Welcome back for existing client', function() {
          element(by.id("new_client_message_first_name")).click();
          browser.wait(EC.visibilityOf(element(by.css("span.welcome-back"))), 10000);
          expect(element(by.css("span.welcome-back")).isPresent()).toBe(true);
        });

        it('LiveSite Portal - Existing client send new message - Messeage Sent', function() {
          element(by.name("commit")).click();
          waitPageToLoad(); 
          expect(element(by.css(".final-container")).isPresent()).toBe(true);
        });

        it('LiveSite Portal - Existing client send new message - Back to home page', function() {
          element(by.css(".standard-button")).click();
          expect(element(by.model("email")).isPresent()).toBe(true);
          browser.driver.sleep(2000);
        });

    } else {

        it('LiveSite Portal - Send new message from the text box - Text Area', function() {
          // expect(element(msgBox.isPresent()).toBe(true);
          element(by.xpath("//div[@id='main_container']/main/div/div/section/div[2]/div/div[2]/footer/form/div[2]/textarea")).sendKeys("Hello!\nHow are you?\nHave a good day! :)");
        });

        it('LiveSite Portal - Send new message from the text box - Message has been sent', function() {
          element(by.xpath("//div[@id='main_container']//button[.='Send']")).click();
          browser.wait(EC.visibilityOf(element(by.xpath("//div[@id='main_container']//h2[.='Quick conversation']"))), 10000);
          browser.driver.sleep(2000);
        });
      }
});

错误:

c:\automation\tests>protractor conf.js
Using the selenium server at http://localhost:4444/wd/hub
[launcher] Running 1 instances of WebDriver
LiveSite Portal - Existing client send new message
  LiveSite - Home Page - pass
  LiveSite Portal - Send new message from the text box - Text Area - fail
  LiveSite Portal - Send new message from the text box - Message has been sent -
 fail


Failures:

  1) LiveSite Portal - Existing client send new message LiveSite Portal - Send n
ew message from the text box - Text Area
   Message:
     ElementNotVisibleError: element not visible
  (Session info: chrome=43.0.2357.81)
  (Driver info: chromedriver=2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9
cf),platform=Windows NT 6.3 x86_64) (WARNING: The server did not provide any sta
cktrace information)
Command duration or timeout: 31 milliseconds
Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'
System info: host: 'vCitaQA', ip: '192.168.56.1', os.name: 'Windows 8.1', os.arc
h: 'amd64', os.version: '6.3', java.version: '1.8.0_25'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEn
abled=false, chrome={userDataDir=C:\Users\idan\AppData\Local\Temp\scoped_dir1204
_19371}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, vers
ion=43.0.2357.81, platform=WIN8_1, browserConnectionEnabled=false, nativeEvents=
true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true,
browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEn
abled=true}]
Session ID: 13c4f345d191f957a186dcefef2e9703
   Stacktrace:
     ElementNotVisibleError: element not visible
  (Session info: chrome=43.0.2357.81)
  (Driver info: chromedriver=2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9
cf),platform=Windows NT 6.3 x86_64) (WARNING: The server did not provide any sta
cktrace information)
Command duration or timeout: 31 milliseconds
Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'
System info: host: 'vCitaQA', ip: '192.168.56.1', os.name: 'Windows 8.1', os.arc
h: 'amd64', os.version: '6.3', java.version: '1.8.0_25'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEn
abled=false, chrome={userDataDir=C:\Users\idan\AppData\Local\Temp\scoped_dir1204
_19371}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, vers
ion=43.0.2357.81, platform=WIN8_1, browserConnectionEnabled=false, nativeEvents=
true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true,
browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEn
abled=true}]
Session ID: 13c4f345d191f957a186dcefef2e9703
    at new bot.Error (C:\Users\idan\AppData\Roaming\npm\node_modules\protractor\
node_modules\selenium-webdriver\lib\atoms\error.js:113:18)
    at Object.bot.response.checkResponse (C:\Users\idan\AppData\Roaming\npm\node
_modules\protractor\node_modules\selenium-webdriver\lib\atoms\response.js:106:9)

    at C:\Users\idan\AppData\Roaming\npm\node_modules\protractor\node_modules\se
lenium-webdriver\lib\webdriver\webdriver.js:377:20
    at [object Object].promise.ControlFlow.runInFrame_ (C:\Users\idan\AppData\Ro
aming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\
promise.js:1877:20)
    at [object Object].promise.Callback_.goog.defineClass.notify (C:\Users\idan\
AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\
webdriver\promise.js:2464:25)
    at [object Object].promise.Promise.notify_ (C:\Users\idan\AppData\Roaming\np
m\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.
js:563:12)
    at Array.forEach (native)
    at Object.goog.array.forEach (C:\Users\idan\AppData\Roaming\npm\node_modules
\protractor\node_modules\selenium-webdriver\lib\goog\array\array.js:203:43)
    at [object Object].promise.Promise.notifyAll_ (C:\Users\idan\AppData\Roaming
\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promi
se.js:552:16)
    at goog.async.run.processWorkQueue (C:\Users\idan\AppData\Roaming\npm\node_m
odules\protractor\node_modules\selenium-webdriver\lib\goog\async\run.js:125:21)
Error
    at [object Object].ElementArrayFinder.applyAction_ (C:\Users\idan\AppData\Ro
aming\npm\node_modules\protractor\lib\element.js:403:21)
    at [object Object].self.(anonymous function) [as sendKeys] (C:\Users\idan\Ap
pData\Roaming\npm\node_modules\protractor\lib\element.js:76:19)
    at [object Object].self.(anonymous function) [as sendKeys] (C:\Users\idan\Ap
pData\Roaming\npm\node_modules\protractor\lib\element.js:733:11)
    at [object Object].<anonymous> (c:\automation\tests\message.js:45:127)
    at C:\Users\idan\AppData\Roaming\npm\node_modules\protractor\node_modules\ja
sminewd\index.js:94:14
    at [object Object].promise.ControlFlow.runInFrame_ (C:\Users\idan\AppData\Ro
aming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\
promise.js:1877:20)
    at [object Object].promise.ControlFlow.runEventLoop_ (C:\Users\idan\AppData\
Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdrive
r\promise.js:1755:8)
    at [object Object].<anonymous> (C:\Users\idan\AppData\Roaming\npm\node_modul
es\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:2056:12)
    at goog.async.run.processWorkQueue (C:\Users\idan\AppData\Roaming\npm\node_m
odules\protractor\node_modules\selenium-webdriver\lib\goog\async\run.js:125:21)
    at runMicrotasksCallback (node.js:337:7)
From: Task: Asynchronous test function: it()
    at [object Object].<anonymous> (C:\Users\idan\AppData\Roaming\npm\node_modul
es\protractor\node_modules\jasminewd\index.js:93:33)
    at [object Object].<anonymous> (C:\Users\idan\AppData\Roaming\npm\node_modul
es\protractor\node_modules\minijasminenode\lib\async-callback.js:45:37)
    at [object Object].jasmine.Block.execute (C:\Users\idan\AppData\Roaming\npm\
node_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:1174:1
7)
    at [object Object].jasmine.Queue.next_ (C:\Users\idan\AppData\Roaming\npm\no
de_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:2209:31)

    at [object Object].jasmine.Queue.start (C:\Users\idan\AppData\Roaming\npm\no
de_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:2162:8)
    at [object Object].jasmine.Spec.execute (C:\Users\idan\AppData\Roaming\npm\n
ode_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:2503:14
)
    at [object Object].jasmine.Queue.next_ (C:\Users\idan\AppData\Roaming\npm\no
de_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:2209:31)

    at onComplete (C:\Users\idan\AppData\Roaming\npm\node_modules\protractor\nod
e_modules\minijasminenode\lib\jasmine-1.3.1.js:2205:18)
    at [object Object].jasmine.Spec.finish (C:\Users\idan\AppData\Roaming\npm\no
de_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:2477:5)
    at [object Object].onComplete (C:\Users\idan\AppData\Roaming\npm\node_module
s\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:2504:10)==== asyn
c task ====
Error
    at [object Object].<anonymous> (c:\automation\tests\message.js:43:9)
    at [object Object].jasmine.Env.describe_ (C:\Users\idan\AppData\Roaming\npm\
node_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:913:21
)
    at [object Object].jasmine.Env.describe (C:\Users\idan\AppData\Roaming\npm\n
ode_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:898:15)

    at describe (C:\Users\idan\AppData\Roaming\npm\node_modules\protractor\node_
modules\minijasminenode\lib\jasmine-1.3.1.js:658:27)
    at Object.<anonymous> (c:\automation\tests\message.js:1:63)

  2) LiveSite Portal - Existing client send new message LiveSite Portal - Send n
ew message from the text box - Message has been sent
   Message:
     ElementNotVisibleError: element not visible
  (Session info: chrome=43.0.2357.81)
  (Driver info: chromedriver=2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9
cf),platform=Windows NT 6.3 x86_64) (WARNING: The server did not provide any sta
cktrace information)
Command duration or timeout: 22 milliseconds
Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'
System info: host: 'vCitaQA', ip: '192.168.56.1', os.name: 'Windows 8.1', os.arc
h: 'amd64', os.version: '6.3', java.version: '1.8.0_25'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEn
abled=false, chrome={userDataDir=C:\Users\idan\AppData\Local\Temp\scoped_dir1204
_19371}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, vers
ion=43.0.2357.81, platform=WIN8_1, browserConnectionEnabled=false, nativeEvents=
true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true,
browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEn
abled=true}]
Session ID: 13c4f345d191f957a186dcefef2e9703
   Stacktrace:
     ElementNotVisibleError: element not visible
  (Session info: chrome=43.0.2357.81)
  (Driver info: chromedriver=2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9
cf),platform=Windows NT 6.3 x86_64) (WARNING: The server did not provide any sta
cktrace information)
Command duration or timeout: 22 milliseconds
Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'
System info: host: 'vCitaQA', ip: '192.168.56.1', os.name: 'Windows 8.1', os.arc
h: 'amd64', os.version: '6.3', java.version: '1.8.0_25'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEn
abled=false, chrome={userDataDir=C:\Users\idan\AppData\Local\Temp\scoped_dir1204
_19371}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, vers
ion=43.0.2357.81, platform=WIN8_1, browserConnectionEnabled=false, nativeEvents=
true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true,
browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEn
abled=true}]
Session ID: 13c4f345d191f957a186dcefef2e9703
    at new bot.Error (C:\Users\idan\AppData\Roaming\npm\node_modules\protractor\
node_modules\selenium-webdriver\lib\atoms\error.js:113:18)
    at Object.bot.response.checkResponse (C:\Users\idan\AppData\Roaming\npm\node
_modules\protractor\node_modules\selenium-webdriver\lib\atoms\response.js:106:9)

    at C:\Users\idan\AppData\Roaming\npm\node_modules\protractor\node_modules\se
lenium-webdriver\lib\webdriver\webdriver.js:377:20
    at [object Object].promise.ControlFlow.runInFrame_ (C:\Users\idan\AppData\Ro
aming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\
promise.js:1877:20)
    at [object Object].promise.Callback_.goog.defineClass.notify (C:\Users\idan\
AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\
webdriver\promise.js:2464:25)
    at [object Object].promise.Promise.notify_ (C:\Users\idan\AppData\Roaming\np
m\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.
js:563:12)
    at Array.forEach (native)
    at Object.goog.array.forEach (C:\Users\idan\AppData\Roaming\npm\node_modules
\protractor\node_modules\selenium-webdriver\lib\goog\array\array.js:203:43)
    at [object Object].promise.Promise.notifyAll_ (C:\Users\idan\AppData\Roaming
\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promi
se.js:552:16)
    at goog.async.run.processWorkQueue (C:\Users\idan\AppData\Roaming\npm\node_m
odules\protractor\node_modules\selenium-webdriver\lib\goog\async\run.js:125:21)
Error
    at [object Object].ElementArrayFinder.applyAction_ (C:\Users\idan\AppData\Ro
aming\npm\node_modules\protractor\lib\element.js:403:21)
    at [object Object].self.(anonymous function) [as click] (C:\Users\idan\AppDa
ta\Roaming\npm\node_modules\protractor\lib\element.js:76:19)
    at [object Object].self.(anonymous function) [as click] (C:\Users\idan\AppDa
ta\Roaming\npm\node_modules\protractor\lib\element.js:733:11)
    at [object Object].<anonymous> (c:\automation\tests\message.js:49:78)
    at C:\Users\idan\AppData\Roaming\npm\node_modules\protractor\node_modules\ja
sminewd\index.js:94:14
    at [object Object].promise.ControlFlow.runInFrame_ (C:\Users\idan\AppData\Ro
aming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\
promise.js:1877:20)
    at [object Object].promise.ControlFlow.runEventLoop_ (C:\Users\idan\AppData\
Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdrive
r\promise.js:1755:8)
    at [object Object].<anonymous> (C:\Users\idan\AppData\Roaming\npm\node_modul
es\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:2056:12)
    at goog.async.run.processWorkQueue (C:\Users\idan\AppData\Roaming\npm\node_m
odules\protractor\node_modules\selenium-webdriver\lib\goog\async\run.js:125:21)
    at runMicrotasksCallback (node.js:337:7)
From: Task: Asynchronous test function: it()
    at [object Object].<anonymous> (C:\Users\idan\AppData\Roaming\npm\node_modul
es\protractor\node_modules\jasminewd\index.js:93:33)
    at [object Object].<anonymous> (C:\Users\idan\AppData\Roaming\npm\node_modul
es\protractor\node_modules\minijasminenode\lib\async-callback.js:45:37)
    at [object Object].jasmine.Block.execute (C:\Users\idan\AppData\Roaming\npm\
node_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:1174:1
7)
    at [object Object].jasmine.Queue.next_ (C:\Users\idan\AppData\Roaming\npm\no
de_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:2209:31)

    at [object Object].jasmine.Queue.start (C:\Users\idan\AppData\Roaming\npm\no
de_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:2162:8)
    at [object Object].jasmine.Spec.execute (C:\Users\idan\AppData\Roaming\npm\n
ode_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:2503:14
)
    at [object Object].jasmine.Queue.next_ (C:\Users\idan\AppData\Roaming\npm\no
de_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:2209:31)

    at onComplete (C:\Users\idan\AppData\Roaming\npm\node_modules\protractor\nod
e_modules\minijasminenode\lib\jasmine-1.3.1.js:2205:18)
    at [object Object].jasmine.Spec.finish (C:\Users\idan\AppData\Roaming\npm\no
de_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:2477:5)
    at [object Object].onComplete (C:\Users\idan\AppData\Roaming\npm\node_module
s\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:2504:10)==== asyn
c task ====
Error
    at [object Object].<anonymous> (c:\automation\tests\message.js:48:9)
    at [object Object].jasmine.Env.describe_ (C:\Users\idan\AppData\Roaming\npm\
node_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:913:21
)
    at [object Object].jasmine.Env.describe (C:\Users\idan\AppData\Roaming\npm\n
ode_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:898:15)

    at describe (C:\Users\idan\AppData\Roaming\npm\node_modules\protractor\node_
modules\minijasminenode\lib\jasmine-1.3.1.js:658:27)
    at Object.<anonymous> (c:\automation\tests\message.js:1:63)

Finished in 9.907 seconds
3 tests, 3 assertions, 2 failures

[launcher] 0 instance(s) of WebDriver still running
[launcher] chrome #1 failed 2 test(s)
[launcher] overall: 2 failed spec(s)
[launcher] Process exited with error code 1

c:\automation\tests>

2 个答案:

答案 0 :(得分:0)

您是否尝试使用beforeEach在2个描述序列中拆分测试?

类似的东西:

describe('LiveSite Portal - Existing client send new message', function() {

    var msgBtn = element(by.xpath("//div[@class='actions-row']//a[.='Leave Your Details']"));
    var EC = protractor.ExpectedConditions;
    var msgBtniIsPresent = true;

    it('LiveSite - Home Page', function() {
        liveSiteHome();
    });

    describe('With msgBtn.isPresent()', function() {
        beforeEach(function(done) {
            msgBtn.isPresent().then(function(isPresent) {
                msgBtniIsPresent = isPresent;
                done();
            });
        });

        if (msgBtniIsPresent) {

            it('LiveSite Portal - Existing client send new message - Message form', function() {
                browser.wait(EC.visibilityOf(msgBtn), 10000);
                element(msgBtn).click();
                waitPageToLoad();
                expect(element(by.id("new_client_message_message")).isPresent()).toBe(true);
                element(by.css("div.row.mandatory > div.area")).click();
                element(by.id("new_client_message_title")).sendKeys("Automation message");
                element(by.id("new_client_message_message")).sendKeys("I am not logged-in client. Please call me.");
                element(by.id("new_client_message_email")).sendKeys("idanvcita@gmail.com");
            });

            it('LiveSite Portal - Existing client send new message - Welcome back for existing client', function() {
                element(by.id("new_client_message_first_name")).click();
                browser.wait(EC.visibilityOf(element(by.css("span.welcome-back"))), 10000);
                expect(element(by.css("span.welcome-back")).isPresent()).toBe(true);
            });

            it('LiveSite Portal - Existing client send new message - Messeage Sent', function() {
                element(by.name("commit")).click();
                waitPageToLoad();
                expect(element(by.css(".final-container")).isPresent()).toBe(true);
            });

            it('LiveSite Portal - Existing client send new message - Back to home page', function() {
                element(by.css(".standard-button")).click();
                expect(element(by.model("email")).isPresent()).toBe(true);
                browser.driver.sleep(2000);
            });

        } else {

            describe('With msgBtn.isPresent() === false', function() {
                it('LiveSite Portal - Send new message from the text box - Text Area', function() {
                    // expect(element(msgBox.isPresent()).toBe(true);
                    element(by.xpath("//div[@id='main_container']/main/div/div/section/div[2]/div/div[2]/footer/form/div[2]/textarea")).sendKeys("Hello!\nHow are you?\nHave a good day! :)");
                });

                it('LiveSite Portal - Send new message from the text box - Message has been sent', function() {
                    element(by.xpath("//div[@id='main_container']//button[.='Send']")).click();
                    browser.wait(EC.visibilityOf(element(by.xpath("//div[@id='main_container']//h2[.='Quick conversation']"))), 10000);
                    browser.driver.sleep(2000);
                });
            });

        }
    });
});

您还可以在需要时使用

手动触发一些屏幕截图
 browser.takeScreenshot().then(function(png) {
     // Do something with the png...
 };

答案 1 :(得分:0)

解决这个问题的方法是根本没有if。查看测试的描述,看起来您运行的是不同的测试,具体取决于用户是否是现有客户端(无论这对您的业务用例如何)。我会为现有客户端进行一组测试,为新客户端进行一组测试,并始终运行这两个测试。您可能必须以不同的用户身份登录/实际创建不同的用户作为测试的一部分,但这很好(根据我的理解,非常标准)。

我还认为这不仅仅是一种解决方法,而是一种改进。你有一套不断的测试,每次测试都在运行,所以如果出现问题,总是会失败。