创建Junit Runnable Jar

时间:2018-02-14 16:22:35

标签: java junit junit4

我的代码在eclipse中运行/工作正常并执行报告。我的问题是我无法创建一个可运行的jar。我在网上搜索过,我看到它的内容:

public static void main(String[] args) throws Exception {                    
       JUnitCore.main(
         "com.stackoverflow.MyTestSuite");            
} 

所以我知道我必须有一个Main课程。但是,我不知道如何在我的代码中实现它,我的代码如下:

//############ Automation using JUnit
@FixMethodOrder(MethodSorters.NAME_ASCENDING) // this allows you to execute test in order 
public class adpOne {


    //Main Method calling individual methods from class [adpTwo.java]
    @Test
    public void bankRatePart1() throws Exception  {
    adpTwo m = new adpTwo();
    // m = short for method

    adpTwo.setUpBeforeClass();
    m.step01_ShouldGo2Website(); 
    m.step02_ShouldMoveToMortgages();
    m.step03_ShouldClickOnCalculators();
    m.step04_ShouldScrollDown(); 

    }


    // Main Method calling individual methods from class [adpTwo.java]
    @Test
    public void bankRatePart2() throws Exception  {
    adpTwo m = new adpTwo();

    m.step05_ShouldClickMorgageLoanPaymentCalc();
    m.step06_ShouldScrollDownCalcPage();
    m.step07_ShouldClearMortgageSendKeys();
    m.step08_ShouldSelectYearValue();

    }

    // Main Method calling individual methods from class [adpTwo.java]
    @Test
    public void bankRatePart3() throws Exception  {
    adpTwo m = new adpTwo();

    m.step09_ShouldSelectInterestRate();
    m.step10_ShouldButtonClick();
    m.step11_ShouldSlideMortgageSlider();
    m.step12_ShouldSlideYearsSlider();
    m.step13_ShouldSlideInterestSlider();
    m.step14_ShouldVerifyCalcutaion();
    m.tearDown();

    }

}

当我尝试使用主类时,我从eclipse中得到错误。 任何帮助将不胜感激。

0 个答案:

没有答案