SergeyPirogov / video-recorder-java

This library allows easily record video of your UI tests by just putting couple annotations.
http://automation-remarks.com/video-recorder-java/
MIT License
219 stars 66 forks source link

Add ability to record whole test flow, starting from @BeforeSuite and finished by @AfterSuite #18

Closed ysparrow closed 8 years ago

ysparrow commented 8 years ago

It would be nice to have configurable feature to record not only methods annotated with @Test, but also a whole test suite in one video file. Our test project has deep inheritance hierarchy with @Before/@After methods in each inherited class, and it is vital to have video for all those before/after activities also.

SergeyPirogov commented 8 years ago

I'm not sure if it should be added as a library listener, by you can easily create SuiteVideoListener see code below:

package com.automation.remarks.testng;

import com.automation.remarks.video.RecorderFactory;
import com.automation.remarks.video.recorder.IVideoRecorder;
import com.automation.remarks.video.recorder.VideoRecorder;
import org.testng.ISuite;
import org.testng.ISuiteListener;

/**
 * Created by sergey on 03.10.16.
 */
public class SuiteVideoListener implements ISuiteListener {

    private IVideoRecorder recorder;

    @Override
    public void onStart(ISuite suite) {
        if (VideoRecorder.conf().isVideoEnabled()) {
            recorder = RecorderFactory.getRecorder();
            recorder.start();
        }
    }

    @Override
    public void onFinish(ISuite suite) {
        if (recorder != null) {
            recorder.stopAndSave(suite.getName());
        }
    }
}
ysparrow commented 8 years ago

Thanks that's what we need ))