第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

@Test方法無(wú)法在TestNG類中注入多個(gè)類

@Test方法無(wú)法在TestNG類中注入多個(gè)類

開滿天機(jī) 2019-04-26 18:15:32
我用TestNG類創(chuàng)建了一個(gè)Maven項(xiàng)目。在TestNG.xml中,我給出了套件名稱。我使用多個(gè)瀏覽器Chrome和Firefox來并行運(yùn)行。只是使用安裝類和另外一個(gè)類它工作正常但是當(dāng)我包含多個(gè)帶@Test注釋的類時(shí),我將得到一個(gè)注入錯(cuò)誤并將給出錯(cuò)誤。我將提供我嘗試過的代碼Setup.java    if (browser.equals("Firefox")) {           /*the path of the gecko driver is set*/           System.setProperty("firefoxpath");           drfirefox=DesiredCapabilities.firefox();           drfirefox.setBrowserName("firefox");           drfirefox.setPlatform(Platform.WINDOWS);         } else {           /*the path of the chrome driver is set*/           System.setProperty("chrome path");           drchrome=DesiredCapabilities.chrome();           drchrome.setBrowserName("chrome");           drchrome.setPlatform(Platform.WINDOWS);         }logintest_valid.java  @Testpublic static void valid_logintest ()throws MalformedURLException, InterruptedException {  }@Test  public static void valid_test ()throws MalformedURLException, InterruptedException {        }我收到的錯(cuò)誤是:無(wú)法使用[class org.openqa.selenium.remote.DesiredCapabilities]注入@Test帶注釋的方法[valid_test]。期望運(yùn)行兩個(gè)測(cè)試用例valid_logintest和valid_test
查看完整描述

2 回答

?
搖曳的薔薇

TA貢獻(xiàn)1793條經(jīng)驗(yàn) 獲得超6個(gè)贊

很可能你在項(xiàng)目的某處有一個(gè)函數(shù),它看起來像:

@Testpublic void sometest(DesiredCapabilities caps) {  }

這不是參數(shù)化TestNG測(cè)試方法的正確方法,你應(yīng)該從@Test注釋的方法中刪除這個(gè)DesiredCapabilities參數(shù)

如果要將外部參數(shù)傳遞給與@Test您一起注釋的方法,則應(yīng)使用@Parameters注釋


查看完整回答
反對(duì) 回復(fù) 2019-05-15
?
慕蓋茨4494581

TA貢獻(xiàn)1850條經(jīng)驗(yàn) 獲得超11個(gè)贊

我的@Test注釋應(yīng)該是非靜態(tài)方法。


查看完整回答
反對(duì) 回復(fù) 2019-05-15
  • 2 回答
  • 0 關(guān)注
  • 865 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)