Một sự lựa chọn khác: Punner, một plugin junit runner và maven song song mới. Bạn không cần phải thay đổi mã của mình, hãy sao chép mã đó vào pom.xml của bạn:
<!-- Disable default surefire based testing -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>com.github.marks-yag</groupId>
<artifactId>punner-maven-plugin</artifactId>
<version>${version}</version>
<configuration>
</configuration>
<executions>
<execution>
<id>test</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
Punner có thể chạy song song các phương pháp thử nghiệm, có thể giữ các đầu ra thử nghiệm riêng biệt và sạch sẽ.
Punner sẽ giảm đầu ra bảng điều khiển mvn của bạn, như sau:
[INFO] --- punner-maven-plugin:0.9.13:test (test) @ ipc ---
[INFO] Punner report directory: /Users/guile/workspace/ipc/target/punner-reports
[INFO]
[INFO] com.github.yag.ipc.IPCTest.testConnectionHandler.............. PASSED
[INFO] com.github.yag.ipc.IPCTest.testSequence....................... PASSED
[INFO] com.github.yag.ipc.IPCTest.testPartialContent................. PASSED
[INFO] com.github.yag.ipc.IPCTest.testResponseContent................ PASSED
[INFO] com.github.yag.ipc.IPCTest.testPingPong....................... PASSED
[INFO] com.github.yag.ipc.IPCTest.testServerClose.................... PASSED
[INFO] com.github.yag.ipc.IPCTest.testServerSideHeartbeatTimeout..... PASSED
[INFO] com.github.yag.ipc.IPCTest.testClientSideHeartbeatTimeout..... PASSED
[INFO] com.github.yag.ipc.IPCTest.testClientSideHeartbeat............ PASSED
[INFO] com.github.yag.ipc.IPCTest.testClientReconnect................ PASSED
[INFO]
[INFO] Tests run: 10, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 10.952 sec, Time saved: 25.919 sec.
Punner tạo ra các đầu ra tương thích chắc chắn, bạn cũng có thể lấy dữ liệu nhật ký thô và báo cáo định dạng đánh dấu từ thư mục báo cáo:
➜ ipc git:(develop) ll target/punner-reports
total 104
-rw-r--r-- 1 guile staff 11K Oct 15 23:07 TEST-com.github.yag.ipc.IPCTest.xml
-rw-r--r-- 1 guile staff 298B Oct 15 23:07 com.github.yag.ipc.IPCTest.txt
drwxr-xr-x 12 guile staff 384B Oct 8 00:50 logs
-rw-r--r-- 1 guile staff 33K Oct 15 23:07 report.md
Punner là dự án cá nhân của tôi, tôi viết Punner để tăng tốc giai đoạn kiểm thử đơn vị của một số dự án khác như khuôn khổ IPC, khóa chi tiết, dịch vụ tạp chí, công cụ quy trình công việc phân tán, v.v. Nó tiết kiệm rất nhiều thời gian chờ đợi của tôi.
Punner chưa hỗ trợ một số tính năng nâng cao. Tôi rất vui nếu bạn có thể thử nó và cho tôi một số phản hồi.