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

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

使用jenkins平臺(tái)在maven項(xiàng)目中運(yùn)行spock測(cè)試

使用jenkins平臺(tái)在maven項(xiàng)目中運(yùn)行spock測(cè)試

滄海一幻覺(jué) 2022-05-25 10:26:21
我創(chuàng)建了由 junit 和 spock 測(cè)試組成的 maven 項(xiàng)目。兩個(gè)測(cè)試的代碼。public class AppTest {    /**     * Rigorous Test :-)     */    @Test    public void shouldAnswerWithTrue()    {        assertTrue( true );    }}class SpockTest extends Specification  {    def "one plus one should equal two"() {        expect:        1 + 1 == 2    }}在我的本地機(jī)器上,當(dāng)我運(yùn)行 mvn test 時(shí),它檢測(cè)了兩個(gè)測(cè)試類(lèi)。我在 git 存儲(chǔ)庫(kù)上部署了項(xiàng)目,并為 maven 項(xiàng)目配置了 jenkins。我推送存儲(chǔ)庫(kù)并為此項(xiàng)目執(zhí)行作業(yè),但是 jenkins 僅檢測(cè)到 JUnit 測(cè)試的 AppTest 類(lèi)。我已更改 pom.xml 并將文件 regadring 添加到https://github.com/menonvarun/testInProgress-spock-client. 我的項(xiàng)目結(jié)構(gòu)。文件 org.spockframework.runtime.extension.IGlobalExtension 的內(nèi)容org.imaginea.jenkins.testinprogress.spock.SpockTestInProgressExtensionpom.xml<repositories>    <repository>      <id>repo.jenkins-ci.org</id>      <url>http://repo.jenkins-ci.org/public/</url>    </repository>  </repositories>  <dependencies>    <dependency>      <groupId>junit</groupId>      <artifactId>junit</artifactId>      <version>4.11</version>      <scope>test</scope>    </dependency>    <dependency>      <groupId>org.spockframework</groupId>      <artifactId>spock-core</artifactId>      <version>1.0-groovy-2.4</version>      <scope>test</scope>    </dependency>    <dependency>      <groupId>org.codehaus.groovy</groupId>      <artifactId>groovy-all</artifactId>      <version>2.4.7</version>      <scope>test</scope>    </dependency>    <dependency>      <groupId>org.imaginea.jenkins.plugins</groupId>      <artifactId>testInProgress-spock-client</artifactId>      <version>0.1</version>      <scope>test</scope>    </dependency>  </dependencies>我在 jenkins 平臺(tái)上安裝了 testInProgress 插件。之后,我將更改的 maven 項(xiàng)目推送到存儲(chǔ)庫(kù)并再次為 maven 項(xiàng)目執(zhí)行作業(yè)。還有一次詹金斯沒(méi)有檢測(cè)到 SpockTest 類(lèi)。可能是什么問(wèn)題呢?
查看完整描述

1 回答

?
森欄

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

嘗試將 spock 測(cè)試放在groovy文件夾下:

  • 源代碼

    • 時(shí)髦的

    • SpockTest.groovy

    • com.jenk...

    • 測(cè)試

然后將gmavenplus-plugin(groovy compiler) 和maven-surefire-plugin(test runner) 添加到pom.xml

    <pluginManagement>

        <plugins>

            <plugin>

                <groupId>org.codehaus.gmavenplus</groupId>

                <artifactId>gmavenplus-plugin</artifactId>

                <version>1.6.2</version>

            </plugin>


            <plugin>

                <groupId>org.apache.maven.plugins</groupId>

                <artifactId>maven-surefire-plugin</artifactId>

                <version>2.22.1</version>

            </plugin>

        </plugins>

    </pluginManagement>


    ...


    <plugins>

        <plugin>

            <groupId>org.codehaus.gmavenplus</groupId>

            <artifactId>gmavenplus-plugin</artifactId>

            <configuration>

                <targetBytecode>1.8</targetBytecode>

                <warningLevel>2</warningLevel>

            </configuration>

            <executions>

                <execution>

                    <goals>

                        <goal>compileTests</goal>

                    </goals>

                </execution>

            </executions>

        </plugin>


        <plugin>

            <groupId>org.apache.maven.plugins</groupId>

            <artifactId>maven-surefire-plugin</artifactId>

        </plugin>

    </plugins>

為了在 Jenkins 上進(jìn)行調(diào)試,以確保更好地觸發(fā)預(yù)期的測(cè)試以防止出現(xiàn)故障:


def "one plus one should equal two"() {

    expect:

    1 + 1 == 3

}


查看完整回答
反對(duì) 回復(fù) 2022-05-25
  • 1 回答
  • 0 關(guān)注
  • 201 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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