久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    <bdo id='GqykR'></bdo><ul id='GqykR'></ul>

  • <i id='GqykR'><tr id='GqykR'><dt id='GqykR'><q id='GqykR'><span id='GqykR'><b id='GqykR'><form id='GqykR'><ins id='GqykR'></ins><ul id='GqykR'></ul><sub id='GqykR'></sub></form><legend id='GqykR'></legend><bdo id='GqykR'><pre id='GqykR'><center id='GqykR'></center></pre></bdo></b><th id='GqykR'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='GqykR'><tfoot id='GqykR'></tfoot><dl id='GqykR'><fieldset id='GqykR'></fieldset></dl></div>

  • <small id='GqykR'></small><noframes id='GqykR'>

      1. <tfoot id='GqykR'></tfoot>
      2. <legend id='GqykR'><style id='GqykR'><dir id='GqykR'><q id='GqykR'></q></dir></style></legend>
      3. 如何使用 Junit 按順序運(yùn)行測(cè)試方法

        How to run test methods in order with Junit(如何使用 Junit 按順序運(yùn)行測(cè)試方法)
          <tbody id='wm74A'></tbody>

        <small id='wm74A'></small><noframes id='wm74A'>

              <bdo id='wm74A'></bdo><ul id='wm74A'></ul>
              • <tfoot id='wm74A'></tfoot>

                  <legend id='wm74A'><style id='wm74A'><dir id='wm74A'><q id='wm74A'></q></dir></style></legend>

                  <i id='wm74A'><tr id='wm74A'><dt id='wm74A'><q id='wm74A'><span id='wm74A'><b id='wm74A'><form id='wm74A'><ins id='wm74A'></ins><ul id='wm74A'></ul><sub id='wm74A'></sub></form><legend id='wm74A'></legend><bdo id='wm74A'><pre id='wm74A'><center id='wm74A'></center></pre></bdo></b><th id='wm74A'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='wm74A'><tfoot id='wm74A'></tfoot><dl id='wm74A'><fieldset id='wm74A'></fieldset></dl></div>

                • 本文介紹了如何使用 Junit 按順序運(yùn)行測(cè)試方法的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                  問(wèn)題描述

                  我正在使用 JUnit 和 Selenium Webdriver.我想按照我在代碼中編寫(xiě)它們的順序運(yùn)行我的測(cè)試方法,如下所示:

                  I am using JUnit and Selenium Webdriver. I want to run my test methods in order as how I write them in my code, as below:

                  @Test
                  public void registerUserTest(){
                      // code
                  }
                  
                  @Test
                  public void welcomeNewUserTest(){
                      // code
                  }
                  
                  @Test
                  public void questionaireNewUserTest(){
                      // code
                  }
                  

                  但它不起作用,它總是按這個(gè)順序執(zhí)行我的測(cè)試方法:

                  But it doesn't work, it always executes my test methods in this order:

                  welcomeNewUserTest()
                  registerUserTest()
                  questionaireNewUserTest()
                  

                  如果我用后綴 Test 命名我的方法,我會(huì)在某處讀到答案,然后 JUnit 會(huì)按照我在代碼中對(duì)它們的排序方式執(zhí)行它們.顯然,這行不通.

                  I read an answer somewhere if I name my method with suffix Test, then JUnit would execute them in order as how I order them in code. Apparently, this doesn't work.

                  有什么幫助嗎?謝謝

                  推薦答案

                  所以對(duì)于像這樣的測(cè)試——步驟相互依賴——你應(yīng)該真正將它們作為一個(gè)單元來(lái)執(zhí)行.你真的應(yīng)該做這樣的事情:

                  So for tests like these - where the steps are dependent on each other - you should really execute them as one unit. You should really be doing something like:

                  @Test
                  public void registerWelcomeAndQuestionnaireUserTest(){
                      // code
                      // Register
                      // Welcome
                      // Questionnaire
                  }
                  

                  正如@Jeremiah 下面提到的,有一些獨(dú)特的方法可以使單獨(dú)的測(cè)試無(wú)法預(yù)測(cè)地執(zhí)行.

                  As @Jeremiah mentions below, there are a handful of unique ways that separate tests can execute unpredictably.

                  既然我已經(jīng)說(shuō)過(guò)了,這就是你的解決方案.

                  Now that I've said that, here's your solution.

                  如果你想要單獨(dú)的測(cè)試,你可以使用 @FixMethodOrder 然后按 NAME_ASCENDING 執(zhí)行.這是我知道的唯一方法.

                  If you want separate tests, you can use @FixMethodOrder and then do it by NAME_ASCENDING. This is the only way I know.

                  @FixMethodOrder(MethodSorters.NAME_ASCENDING)
                  public class TestMethodOrder {
                  
                      @Test
                      public void testA() {
                          System.out.println("first");
                      }
                      @Test
                      public void testC() {
                          System.out.println("third");
                      }
                      @Test
                      public void testB() {
                          System.out.println("second");
                      }
                  }
                  

                  將執(zhí)行:

                  testA(), testB(), testC()

                  在你的情況下:

                  @FixMethodOrder(MethodSorters.NAME_ASCENDING)
                  public class ThisTestsEverything{
                  
                      @Test
                      public void T1_registerUser(){
                          // code
                      }
                  
                      @Test
                      public void T2_welcomeNewUser(){
                          // code
                      }
                  
                      @Test
                      public void T3_questionaireNewUser(){
                          // code
                      }
                  
                  }
                  

                  這篇關(guān)于如何使用 Junit 按順序運(yùn)行測(cè)試方法的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  How can I detect integer overflow on 32 bits int?(如何檢測(cè) 32 位 int 上的整數(shù)溢出?)
                  Local variables before return statements, does it matter?(return 語(yǔ)句之前的局部變量,這有關(guān)系嗎?)
                  How to convert Integer to int?(如何將整數(shù)轉(zhuǎn)換為整數(shù)?)
                  How do I create an int array with randomly shuffled numbers in a given range(如何在給定范圍內(nèi)創(chuàng)建一個(gè)隨機(jī)打亂數(shù)字的 int 數(shù)組)
                  Inconsistent behavior on java#39;s ==(java的行為不一致==)
                  Why is Java able to store 0xff000000 as an int?(為什么 Java 能夠?qū)?0xff000000 存儲(chǔ)為 int?)
                  <tfoot id='tuFeV'></tfoot>
                    <tbody id='tuFeV'></tbody>

                  <small id='tuFeV'></small><noframes id='tuFeV'>

                    <i id='tuFeV'><tr id='tuFeV'><dt id='tuFeV'><q id='tuFeV'><span id='tuFeV'><b id='tuFeV'><form id='tuFeV'><ins id='tuFeV'></ins><ul id='tuFeV'></ul><sub id='tuFeV'></sub></form><legend id='tuFeV'></legend><bdo id='tuFeV'><pre id='tuFeV'><center id='tuFeV'></center></pre></bdo></b><th id='tuFeV'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='tuFeV'><tfoot id='tuFeV'></tfoot><dl id='tuFeV'><fieldset id='tuFeV'></fieldset></dl></div>
                  1. <legend id='tuFeV'><style id='tuFeV'><dir id='tuFeV'><q id='tuFeV'></q></dir></style></legend>

                        • <bdo id='tuFeV'></bdo><ul id='tuFeV'></ul>
                            主站蜘蛛池模板: 国产精品亚洲一区二区三区在线 | 久久99视频精品 | 中文字幕99| 一级片视频免费观看 | 国产成人精品久久 | 久久久免费 | 九一国产精品 | 久久久精品网 | 国产成人网| av在线播放免费 | jizz18国产 | 一区二区视频 | 视频一区二区国产 | 国产一区二区日韩 | 成人免费精品 | 偷拍自拍网址 | 欧美日韩视频在线第一区 | 日韩伦理一区二区三区 | 在线免费视频一区 | 国产三级精品视频 | 久久r免费视频 | 九九热久久免费视频 | 亚洲一区 中文字幕 | 久久精品视频99 | av毛片 | 欧美在线小视频 | 成人在线中文字幕 | 国产欧美精品一区二区色综合朱莉 | 97色在线视频 | 中文字字幕一区二区三区四区五区 | 精品无码久久久久久国产 | 黄色在线观看 | 中文字幕在线视频免费视频 | 911精品国产| 日本一区二区不卡视频 | 久久久久久久久久久成人 | 国产精品亚洲精品日韩已方 | av在线天天| 九九99九九精彩46 | 日韩精品久久一区二区三区 | 91人人爽 |