Skip to content

Instantly share code, notes, and snippets.

@nick318
Created February 26, 2018 09:57
Show Gist options
  • Save nick318/37ded9c044a5218dfed77b92f817f818 to your computer and use it in GitHub Desktop.
Save nick318/37ded9c044a5218dfed77b92f817f818 to your computer and use it in GitHub Desktop.
Copy logs from rest assured to allure
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