簡體   English   中英

如何僅使用gradle wrapper命令在TestSuite類中運行測試

[英]How to only run tests in a TestSuite class with gradle wrapper command

我有一個testSuite類:

package com.company.tests;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;

import com.company.tests.facing.CustomerTests;
import com.company.tests.backend.BookTests;
import com.company.tests.backend.ChargeTests;

@RunWith(Suite.class)
@Suite.SuiteClasses({
CustomerTests.class,
BookTests.class,
ChargeTests.class,
})

public class TestSuite {
}

我使用gradle包裝器運行測試,如下所示:

./gradlew test -PTestSuite

...但是這將在/ src / test / java / com / company / tests /下運行所有測試

有沒有一種方法可以使用命令行中的gradle包裝器在TestSuite類中運行那些方法 我查看了關於stackoverflow的其他問題,但無法解決,請舉個例子。

這可以通過運行以下命令來實現:

./gradlew test --tests TestSuite

並且文檔提供了有關其支持的匹配類型的信息。 請注意,這假設使用Gradle 4.7+

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM