最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

java - Report Portal is not publishing the reports when using with TestNG project - Stack Overflow

programmeradmin4浏览0评论

I am trying to use Report Portal for my current TestNG framework but, it is not attaching the logs to the report. I have followed all the required steps to be done as per this document agent-java-testNG

Here is the sample which I tried:

  1. Added 'reportportal.properties' configuration file with following contents: rp.endpoint = http://localhost:8080 rp.api.key = e0e541d8-b1cd-426a-ae18-b771173c545a rp.launch = TestNG Tests rp.project = default_personal
  1. Created a file '.testng.ITestNGListener' under '/META-INF/services/' and placed the below content:

    com.epam.reportportal.testng.ReportPortalTestNGListener

  2. Added following dependency:

    <dependency> <groupId>com.epam.reportportal</groupId> <artifactId>agent-java-testng</artifactId> <version>5.4.6</version> <scope>test</scope> </dependency>

    <dependency> <groupId>com.epam.reportportal</groupId> <artifactId>logger-java-log4j</artifactId> <version>5.2.3</version> <scope>test</scope> </dependency>

Following are the images: [![Project files][2]][2]

#[2]: .png

------------UPDATED------------- I am using the new repo -->>

here I see that it is throwing following error. Seems local instance of RP is not accessible from testing env. I am using Docker desktop.

    2025-03-13 13:24:24,862 [rp-io-2] ERROR com.epam.reportportal.service.Launch - [41] ReportPortal execution error
retrofit2.adapter.rxjava2.HttpException: HTTP 403 Forbidden
    at retrofit2.adapter.rxjava2.BodyObservable$BodyObserver.onNext(BodyObservable.java:57)
    at retrofit2.adapter.rxjava2.BodyObservable$BodyObserver.onNext(BodyObservable.java:38)
    at retrofit2.adapter.rxjava2.CallExecuteObservable.subscribeActual(CallExecuteObservable.java:48)
    at io.reactivex.Observable.subscribe(Observable.java:12267)
    at retrofit2.adapter.rxjava2.BodyObservable.subscribeActual(BodyObservable.java:35)
    at io.reactivex.Observable.subscribe(Observable.java:12267)
    at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeTask.run(ObservableSubscribeOn.java:96)
    at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:38)
    at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:26)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
    at java.base/java.lang.Thread.run(Thread.java:1575)
2025-03-13 13:24:24,895 [rp-io-2] ERROR com.epam.reportportal.service.Launch - [41] ReportPortal execution error
retrofit2.adapter.rxjava2.HttpException: HTTP 403 Forbidden
    at retrofit2.adapter.rxjava2.BodyObservable$BodyObserver.onNext(BodyObservable.java:57)
    at retrofit2.adapter.rxjava2.BodyObservable$BodyObserver.onNext(BodyObservable.java:38)
    at retrofit2.adapter.rxjava2.CallExecuteObservable.subscribeActual(CallExecuteObservable.java:48)
    at io.reactivex.Observable.subscribe(Observable.java:12267)
    at retrofit2.adapter.rxjava2.BodyObservable.subscribeActual(BodyObservable.java:35)
    at io.reactivex.Observable.subscribe(Observable.java:12267)
    at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeTask.run(ObservableSubscribeOn.java:96)
    at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:38)
    at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:26)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
    at java.base/java.lang.Thread.run(Thread.java:1575)

I am trying to use Report Portal for my current TestNG framework but, it is not attaching the logs to the report. I have followed all the required steps to be done as per this document agent-java-testNG

Here is the sample which I tried:

  1. Added 'reportportal.properties' configuration file with following contents: rp.endpoint = http://localhost:8080 rp.api.key = e0e541d8-b1cd-426a-ae18-b771173c545a rp.launch = TestNG Tests rp.project = default_personal
  1. Created a file '.testng.ITestNGListener' under '/META-INF/services/' and placed the below content:

    com.epam.reportportal.testng.ReportPortalTestNGListener

  2. Added following dependency:

    <dependency> <groupId>com.epam.reportportal</groupId> <artifactId>agent-java-testng</artifactId> <version>5.4.6</version> <scope>test</scope> </dependency>

    <dependency> <groupId>com.epam.reportportal</groupId> <artifactId>logger-java-log4j</artifactId> <version>5.2.3</version> <scope>test</scope> </dependency>

Following are the images: [![Project files][2]][2]

#[2]: https://i.sstatic/6HNdNRkB.png

------------UPDATED------------- I am using the new repo -->> https://github/reportportal/examples-java/tree/master

here I see that it is throwing following error. Seems local instance of RP is not accessible from testing env. I am using Docker desktop.

    2025-03-13 13:24:24,862 [rp-io-2] ERROR com.epam.reportportal.service.Launch - [41] ReportPortal execution error
retrofit2.adapter.rxjava2.HttpException: HTTP 403 Forbidden
    at retrofit2.adapter.rxjava2.BodyObservable$BodyObserver.onNext(BodyObservable.java:57)
    at retrofit2.adapter.rxjava2.BodyObservable$BodyObserver.onNext(BodyObservable.java:38)
    at retrofit2.adapter.rxjava2.CallExecuteObservable.subscribeActual(CallExecuteObservable.java:48)
    at io.reactivex.Observable.subscribe(Observable.java:12267)
    at retrofit2.adapter.rxjava2.BodyObservable.subscribeActual(BodyObservable.java:35)
    at io.reactivex.Observable.subscribe(Observable.java:12267)
    at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeTask.run(ObservableSubscribeOn.java:96)
    at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:38)
    at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:26)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
    at java.base/java.lang.Thread.run(Thread.java:1575)
2025-03-13 13:24:24,895 [rp-io-2] ERROR com.epam.reportportal.service.Launch - [41] ReportPortal execution error
retrofit2.adapter.rxjava2.HttpException: HTTP 403 Forbidden
    at retrofit2.adapter.rxjava2.BodyObservable$BodyObserver.onNext(BodyObservable.java:57)
    at retrofit2.adapter.rxjava2.BodyObservable$BodyObserver.onNext(BodyObservable.java:38)
    at retrofit2.adapter.rxjava2.CallExecuteObservable.subscribeActual(CallExecuteObservable.java:48)
    at io.reactivex.Observable.subscribe(Observable.java:12267)
    at retrofit2.adapter.rxjava2.BodyObservable.subscribeActual(BodyObservable.java:35)
    at io.reactivex.Observable.subscribe(Observable.java:12267)
    at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeTask.run(ObservableSubscribeOn.java:96)
    at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:38)
    at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:26)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
    at java.base/java.lang.Thread.run(Thread.java:1575)
Share Improve this question edited Mar 13 at 9:35 nik asked Mar 9 at 11:52 niknik 1072 silver badges14 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

I see you are using logger-java-log4j - ReportPortal logger for Log4j library, but on your screenshot I see logback.xml configuration, which is for Logback library. For using ReportPortal with Logback you need to use logger-java-logback logger. Check out Logback and logger configuration documentation here: https://github/reportportal/logger-java-logback

Or if you actually want to use ReportPortal with Log4j, check out documentation here: https://github/reportportal/logger-java-log4j

Although, there are a project with examples: https://github/reportportal/examples-java

example-testng-log4j module inside the project stands for TestNG with Log4j2 configuration example. And example-testng-logback for TestNG with Logback.

发布评论

评论列表(0)

  1. 暂无评论