我有一个测试类,其中包含多个测试方法,我希望按照某些标准进行分组。为此,在方法级别上使用JUnit的@Category
注释似乎是一个很好的解决方案:
public class TestClass {
@Test
@Category(AssignmentServiceCategory.class)
public void testMethod1() {}
@Test
@Category(OtherCategory.class)
public void testMethod2() {}
}
我想在IntelliJ IDEA中为这些单独的类别创建不同的运行配置,以便仅执行使用特定类别注释的测试方法。我的配置如下所示:
但是,当我运行它时,将运行声明方法的类中的所有测试,而不是仅运行使用指定类别注释的测试。我的配置是否不正确,或IDEA是否仅允许类级@Category
注释?
版本:
答案 0 :(得分:0)
我在Intellij 2020.1.2中遇到了同样的问题
似乎与您为<div class="container">
<header>
<h1 id="title">Survey Form</h1>
<p id="description">Thank you for helping us improve by taking this survey.</p>
</header>
<div id="form">
<form id="survey-form">
<div class="form-group">
<label id="name-label" for="name">Name</label>
<input type="text" id="name" name="name" placeholder="Enter your name" required>
</div>
<div class="form-group">
<label id="email-label" for="email">Email</label>
<input type="email" id="email" name="email" placeholder="Enter your email" pattern=".+@.+\..+" required>
<div>
<div class="form-group">
<label id="number-label" for="number">Age (optional)</label>
<input type="number" id="number" name="age" placeholder="Enter your email" min="1" max="200" required>
<div class="form-group">
<p>What's your coding experience?</p>
<label>
<input type="radio" name="user-experience" value="noob" class="input-radio" />
Noob
</label>
<label>
<input type="radio" name="user-experience" value="dangerous" class="input-radio" checked/>
Dangerous
</label>
<label>
<input type="radio" name="user-experience" value="veteran" class="input-radio" />
Veteran
</label>
</div>
<div class="form-group">
<p>What programing language do you use the most at work?</p>
<select id="dropdown" class="form-group" name="language" required>
<option disabled selected value>Select a language</option>
<option value="java">Java</option>
<option value="javascript">JavaScript</option>
<option value="python">Python</option>
<option value="c++">C++</option>
<option value="c">C</option>
<option value="c#">C#</option>
<option value="php">PHP</option>
<option value="ruby">Ruby</option>
</select>
</div>
<div class="form-group">
<p>Do you like to work on the Front-end or Back-end? <span class="clue">(Check all that apply)</span</p>
<label>
<input name="prefer" value="front-end-projects" type="checkbox" class="input-checkbox" />Front-end
</label>
<label>
<input name="prefer" value="back-end-projects" type="checkbox" class="input-checkbox" />Back-end
</label>
</div>
<div class="form-group">
<p>Please provide any comments if we missed anything?</p>
<textArea id="comments" name="comment" placeholder="Place your comments here..."></textArea>
<div>
<div class="form-group">
<button type="submit" id="submit" class="submit-button">Submit</button>
<div>
</form>
</div>
</div>
选择的设置有关的错误。
如果我选择search for tests
all ,则将执行测试,甚至是带有其他类别注释的测试。
如果我选择其他任何选项(in single module
,in whole project
),它都可以正常工作。