Skip to content

Specify run order#2

Draft
amamiya-yuuko-1225 wants to merge 6 commits into
masterfrom
modifiedRunOrder
Draft

Specify run order#2
amamiya-yuuko-1225 wants to merge 6 commits into
masterfrom
modifiedRunOrder

Conversation

@amamiya-yuuko-1225

@amamiya-yuuko-1225 amamiya-yuuko-1225 commented Jul 27, 2022

Copy link
Copy Markdown
Owner

This PR is a new implement for PR#348.

The changes in this pull request enable Surefire to run test classes and test methods in any order specified by a newly added <runOrder> (testorder). Namely, the changes include

  • A new <runOrder> called testorder that would make Surefire run test classes and test methods in the order specified by <test>. Regex and include/exclude are supported as is the case for other runOrders
  • Tests for the newly added features

The newly added testorder <runOrder> is supported for JUnit 3 and JUnit 4 tests.

Moreover, I have also implement a preliminary support for JUnit5, but I need some help to make it better. For this reason, I created another PR to show that change. Looking forward to discuss it with you developers about this issue.

Simple (no regex) example using Http-Request:

mvn test -Dsurefire.runOrder=testorder \
-Dtest=com.github.kevinsawicki.http.HttpRequestTest#getUrlEncodedWithPercent,\
com.github.kevinsawicki.http.HttpRequestTest#uploadProgressSendReader,\
com.github.kevinsawicki.http.HttpRequestTest#malformedStringUrlCause,\
com.github.kevinsawicki.http.EncodeTest#encode

Output from Maven should say that the test class HttpRequestTest ran before EncodeTest

The file HttpRequestTest.xml (http-request/lib/target/surefire-reports/TEST-com.github.kevinsawicki.http.HttpRequestTest.xml) should say

<testcase name="getUrlEncodedWithPercent"...>
<testcase name="uploadProgressSendReader"...>
<testcase name="malformedStringUrlCause...>

Regex example using Http-Request:

mvn test -Dsurefire.runOrder=testorder \
-Dtest=com.github.kevinsawicki.http.EncodeTest*,\
com.github.kevinsawicki.http.HttpRequestTest#getUrl*

Output from Maven should say

Tests run: 2 … in 
com.github.kevinsawicki.http.EncodeTest
Tests run: 4 … in
com.github.kevinsawicki.http.HttpRequestTest

The file HttpRequestTest.xml (http-request/lib/target/surefire-reports/TEST-com.github.kevinsawicki.http.HttpRequestTest.xml) should say

<testcase name=”getUrlEncodedWithPercent”...>
<testcase name="getUrlEncodedWithSpace"...>
<testcase name="getUrlEncodedWithUnicode”...>
<testcase name="getUrlEmpty”...>

Include/Exclude example using Http-Request:

mvn test -Dsurefire.runOrder=testorder \
-Dtest=com.github.kevinsawicki.http.HttpRequestTest#getUrl*,\
\!com.github.kevinsawicki.http.HttpRequestTest#getUrlEmpty

Output from Maven should say
Tests run: 3 … in

com.github.kevinsawicki.http.HttpRequestTest

The file HttpRequestTest.xml (http-request/lib/target/surefire-reports/TEST-com.github.kevinsawicki.http.HttpRequestTest.xml) should say

<testcase name=”getUrlEncodedWithPercent”...>
<testcase name="getUrlEncodedWithSpace"...>
<testcase name="getUrlEncodedWithUnicode”...>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant