Created
February 26, 2018 09:57
-
-
Save nick318/37ded9c044a5218dfed77b92f817f818 to your computer and use it in GitHub Desktop.
Copy logs from rest assured to allure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.company; | |
import io.qameta.allure.Step; | |
import java.io.*; | |
/** | |
* Class for copy logs into Allure | |
*/ | |
public class AllurePrintStream extends PrintStream | |
implements Appendable, Closeable { | |
private String requestType = "Undefined type"; | |
public AllurePrintStream(OutputStream out) { | |
super(out); | |
} | |
@Override | |
public void print(String s) { | |
super.print(s); | |
showRequest(s, this.requestType); | |
this.requestType = "Undefined type"; | |
} | |
@Step(value = "Show {requestType}") | |
private void showRequest(String json, String requestType) { | |
} | |
public void setRequestType(String requestType) { | |
this.requestType = requestType; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment