Giter Site home page Giter Site logo

sergeypirogov / video-recorder-java Goto Github PK

View Code? Open in Web Editor NEW
219.0 28.0 65.0 3.79 MB

This library allows easily record video of your UI tests by just putting couple annotations.

Home Page: http://automation-remarks.com/video-recorder-java/

License: MIT License

Java 89.77% Groovy 10.23%
test automation testng junit automation-remarks

video-recorder-java's Introduction

Video Recorder

Build Status

This library allows easily record video of your UI tests by just putting couple annotations.

Supports popular Java test frameworks:

  • JUnit

  • TestNg

  • Spock

  • Selenium Grid

JUnit Rule:

maven
<dependency>
  <groupId>com.automation-remarks</groupId>
  <artifactId>video-recorder-junit</artifactId>
  <version>LATEST</version>
</dependency>
gradle
compile group: 'com.automation-remarks', name: 'video-recorder-junit', version: '1.+'
JUnitVideoTest.class
import com.automation.remarks.video.annotations.Video;
import com.automation.remarks.video.junit.VideoRule;
import org.junit.Rule;
import org.junit.Test;

import static junit.framework.Assert.assertTrue;

public class JUnitVideoTest {

    @Rule
    public VideoRule videoRule = new VideoRule();

    @Test
    @Video
    public void shouldFailAndCreateRecordWithTestName() {
        Thread.sleep(5000);
        assert false;
    }

    @Test
    @Video(name = "second_test")
    public void videoShouldHaveNameSecondTest() {
        Thread.sleep(10000);
        assertTrue(false);
    }
}

JUnit 5

gradle
compile group: 'com.automation-remarks', name: 'video-recorder-junit5', version: '1.+'
import com.automation.remarks.junit5.Video;
public class JUnitVideoTest {

    @Test
    @Video
    public void shouldFailAndCreateRecordWithTestName() {
        Thread.sleep(5000);
        assert false;
    }

    @Test
    @Video(name = "second_test")
    public void videoShouldHaveNameSecondTest() {
        Thread.sleep(10000);
        assertTrue(false);
    }
}

TestNG:

maven
<dependency>
  <groupId>com.automation-remarks</groupId>
  <artifactId>video-recorder-testng</artifactId>
  <version>LATEST</version>
</dependency>
gradle
compile group: 'com.automation-remarks', name: 'video-recorder-testng', version: '1.+'
TestNgVideoTest.class
import com.automation.remarks.video.annotations.Video;
import com.automation.remarks.video.testng.VideoListener;
import org.testng.annotations.Listeners;
import org.testng.annotations.Test;

import static org.testng.Assert.assertTrue;

@Listeners(UniversalVideoListener.class)
public class TestNgVideoTest {

    @Test
    @Video
    public void shouldFailAndCreateRecordWithTestName() {
        Thread.sleep(1000);
        assert false;
    }

    @Test
    @Video(name = "second_test")
    public void videoShouldHaveNameSecondTest(){
        Thread.sleep(1000);
        assertTrue(false);
    }
}

Configuration

You are able to set some configuration parameters for Video Recorder.

Create properties file video.properties in classpath:

video.folder=${user home}/video
video.enabled=false               // default true
video.mode=ALL                    // default ANNOTATED
recorder.type=FFMPEG              // default MONTE
video.save.mode=ALL               // default FAILED_ONLY
video.frame.rate=1                // default 24
ffmpeg.format=x11grab             // default value depends on OS platform
ffmpeg.display=:0.0               // default value depends on OS platform
ffmpeg.pixelFormat=yuv444p        // default yuv420p (for Apple QuickTime player compatibility)

or with maven

 mvn test -Dvideo.folder=custom_folder // default video
          -Dvideo.enabled=false        // default true
          -Dvideo.mode=ALL             // default ANNOTATED
          -Drecorder.type=FFMPEG       // default MONTE
          -Dvideo.save.mode=ALL        // default FAILED_ONLY
          -Dvideo.frame.rate=1         // default 24
          -Dvideo.screen.size=1024x768 // custom screen size
          -Dffmpeg.display=:1.0+10,20  // custom display configuration for ffmpeg
          -Dffmpeg.pixelFormat=yuv444p // default yuv420p

FFMPEG recorder configuration

In order to use ffmpeg type recorder first you need to perform such steps:

Linux or Mac

Need to install ffmpeg recorder

On ubuntu you can do it using such command:

sudo add-apt-repository ppa:mc3man/trusty-media
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install ffmpeg

For Mac just use brew:

brew install ffmpeg

Windows

In case of Windows platform you need to download ffmpeg

Just download it and unzip to some folder on you PC. Example C:\ffmpeg

Then set System variable path for ffmpeg. Example

Example: add to PATH variable ;C:\ffmpeg\bin

Also you need to download SendSignalCtrlC.exe utility and put into the folder ffmpeg/bin.

The final result should be folder with ffmpeg, SendSignalCtrlC.exe utilities and System variable that point to this folder.

To be sure that everything works properly, open CMD and perform first command:

ffmpeg

The output should look like this:

C:\Users\sepi>ffmpeg
ffmpeg version N-81234-ge1be80a Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.4.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-libebur128 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 28.100 / 55. 28.100
  libavcodec     57. 51.100 / 57. 51.100
  libavformat    57. 44.100 / 57. 44.100
  libavdevice    57.  0.102 / 57.  0.102
  libavfilter     6. 49.100 /  6. 49.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'

Than execute in CMD another command:

SendSignalCtrlC

Output:

C:\Users\sepi>SendSignalCtrlC
SendSignalCtrlC <pid>
  <pid> - send ctrl-c to process <pid> (hex ok)

If no errors, that everything set properly. You can you FFMPEG recorder type in ypur tests

Remote Video Recording:

Build remote module:

./gradlew remote:jar

Run hub:

java -jar video-recorder-remote-x.x.jar -role hub

Run node:

java -jar video-recorder-remote-x.x.jar -servlets "com.automation.remarks.remote.node.Video" -role node -port 5555 -hub "http://localhost:4444/grid/register"

TestNG + Remote Video recorder

Change listener in your tests to RemoteVideoListener:

TestNgRemoteVideonTest.class
import com.automation.remarks.testng.GridInfoExtractor;
import com.automation.remarks.testng.RemoteVideoListener;
import com.automation.remarks.video.annotations.Video;
import com.automation.remarks.video.recorder.VideoRecorder;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Listeners;
import org.testng.annotations.Test;

import java.net.URL;

import static com.automation.remarks.testng.test.TestNGRemoteListenerTest.startGrid;
import static org.testng.Assert.fail;


@Listeners(UniversalVideoListener.class)
public class IntegrationTest {

    RemoteWebDriver driver;

    @BeforeClass
    public void setUp() throws Exception {
        URL hubUrl = new URL("http://localhost:4444/wd/hub");
        driver = new RemoteWebDriver(hubUrl, DesiredCapabilities.firefox());
        String nodeIp = GridInfoExtractor.getNodeIp(hubUrl, driver.getSessionId().toString());
        System.setProperty("video.remote", "true");
        System.setProperty("remote.video.hub", nodeIp);
    }

    @Test
    @Video
    public void test() throws InterruptedException {
        driver.get("http://automation-remarks.com");
    }
}

Recorder logging

You can log recorder events using log4j.

Just need to set DEBUG level fot package com.automation.remarks.video.recorder

Log4j settings example: with Console and File appenders.

log4j.rootLogger=INFO, CA, FA

#Console Appender
log4j.appender.CA=org.apache.log4j.ConsoleAppender
log4j.appender.CA.layout=org.apache.log4j.PatternLayout
log4j.appender.CA.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n

#File Appender
log4j.appender.FA=org.apache.log4j.FileAppender
log4j.appender.FA.File=ffmpeg.log
log4j.appender.FA.layout=org.apache.log4j.PatternLayout
log4j.appender.FA.layout.ConversionPattern=[%-5p] %d %c - %m%n

# Set the logger level of File Appender to DEBUG
log4j.logger.com.automation.remarks.video.recorder=DEBUG, FA
log4j.additivity.com.automation.remarks.video.recorder=false

video-recorder-java's People

Contributors

asolntsev avatar gospodinkot avatar liying2010 avatar rosolko avatar sergeypirogov avatar shubicus avatar vanclist avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

video-recorder-java's Issues

[Testng] can't record video when extends class `AbstractTestNGSpringContextTests`

Steps:
I can't record video when implement a testng test as below:

@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE)
@ContextConfiguration(classes = [AppConfig.class])
@TestExecutionListeners(PATestListener.class)
public class TestNgVideoTest extends AbstractTestNGSpringContextTests {
 
  @Test
  @Video
  public void shouldFailAndCreateRecordWithTestName() {
    Thread.sleep(1000);
    assert false
  }

  @Test
  @Video(name = "second_test")
  public void videoShouldHaveNameSecondTest(){
    Thread.sleep(1000);
    assert true
  }
}

But it will work as usual when i removing AbstractTestNGSpringContextTests

I implement this because i want to develop test for Spring application

test not passed on Windows OS

Use File.separator instead "/" to pass this test on Windows OS
@Test public void shouldBeAbsoluteRecordingPath() throws Exception { recordVideo(); String lastRecordingPath = VideoRecorder.getLastRecordingPath(); assertThat(lastRecordingPath, startsWith(conf().getVideoFolder().getAbsolutePath() + File.separator + VIDEO_FILE_NAME)); }

User cannot change video folder using java api

Hi, in that commit you deleted some setters from configuration, why did you do that?

0550699

So, my code does not work anymore:

VideoRecorder.conf() .withVideoFolder("target/videos") .videoEnabled(true) .withVideoSaveMode(VideoSaveMode.FAILED_ONLY);

not update RemoteVideoListener.java for New RecordingMode.ALL

you forgot to rewrite the class testng/src/main/java/com/automation/remarks/testng/RemoteVideoListener.java
to work with new Mode (RecordingMode.ALL)

Change to
private boolean videoEnabled(Video video) { return VideoRecorder.conf().getMode().equals(ALL) || (video != null && video.enabled()); }

Set path to video.folder doesnt work

My video.profile file:

video.folder=./report-video
video.enabled=true
video.mode=ALL
video.save.mode=ALL
video.frame.rate=24

but still, after running the tests, it saves to "video" folder (which I believe is default folder) instead.

IO Exception: Unable to execute command

Environment: Win 8.1
Test runner: TestNG (VideoListener is added via testng.xml)

Here is what log tells:
15:04:28 INFO -Trying to execute the following command: [ffmpeg, -y, -video_size, 1920x1080, -f, gdigrab, -i, desktop, -an, -r, 24, C:\temporary_recording_2016_29_09_15_04_03.mp4]
15:04:28 WARN -Unable to execute command: java.io.IOException: Could not execute [ffmpeg, -y, -video_size, 1920x1080, -f, gdigrab, -i, desktop, -an, -r, 24, C:\temporary_recording_2016_29_09_15_04_03.mp4].

Video Recorder configuration:
VideoRecorder.conf().withVideoFolder("C:")
.withVideoSaveMove(VideoSaveMode.FAILED_ONLY)
.withRecorderType(RecorderType.FFMPEG)
.withRecordMode(RecordingMode.ALL);

P.S. temporary video file is not created at this line 'outputFile = getDestinationFile(TEM_FILE_NAME);'

Do NOT include 3rd party dependencies

Starting from version 1.0.7, video-recorder-core.jar includes 3rd party dependencies (inside JAR!):

  • commons-io
  • commons-lang3
  • org.awaitility:awaitility
  • org.zeroturnaround:zt-exec

It's bad.
It doesn't allow me using other versions of these dependencies in my project.
And it brings too old versions of some dependencies.
Please exclude them.
The standard dependency resolving mechanism of Maven, Gradle etc. will bring these dependencies as JAR files.

NB! It's critical!
It doesn't allow me upgrading to video-recorder 1.0.7

Can't attach *.mp4 video to the Allure2 report (JUnit4)

Can't attach .mp4 video to the Allure2 report

Does it should be added automatically in case of failed testcase or it(method/config/etc) should be written somewhere in code?

OS: Windows 10, x64
FFMPEG: 3.3.2 (x64)

video.properties file:
video.folder= ${user home}/video
video.enabled=true
video.mode=ANNOTATED
recorder.type=FFMPEG
video.save.mode=FAILED_ONLY
video.frame.rate=24

`POM:

<groupId>test</groupId>
<artifactId>test</artifactId>
<version>0.1</version>

<properties>
    <allure.version>LATEST</allure.version>
    <selenide.version>LATEST</selenide.version>
    <aspectj.version>1.8.10</aspectj.version>
    <compiler.version>1.7</compiler.version>
    <video-recorder-junit.version>1.4</video-recorder-junit.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>

<dependencies>
    <dependency>
        <groupId>io.qameta.allure</groupId>
        <artifactId>allure-junit4</artifactId>
        <version>${allure.version}</version>
    </dependency>
    <dependency>
        <groupId>com.codeborne</groupId>
        <artifactId>selenide</artifactId>
        <version>${selenide.version}</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <version>1.7.21</version>
    </dependency>
    <dependency>
        <groupId>com.tngtech.java</groupId>
        <artifactId>junit-dataprovider</artifactId>
        <version>1.10.0</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.automation-remarks</groupId>
        <artifactId>video-recorder-junit</artifactId>
        <version>${video-recorder-junit.version}</version>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.20</version>
            <configuration>
                <testFailureIgnore>true</testFailureIgnore>
                <argLine>
                    -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
                </argLine>
                <properties>
                    <property>
                        <name>listener</name>
                        <value>io.qameta.allure.junit4.AllureJunit4</value>
                    </property>
                </properties>
                <systemProperties>
                    <property>
                        <name>allure.results.directory</name>
                        <value>${project.build.directory}/allure-results</value>
                    </property>
                    <property>
                        <name>allure.link.issue.pattern</name>
                        <value>https://jira.intetics.com/browse/{}</value>
                    </property>
                </systemProperties>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.aspectj</groupId>
                    <artifactId>aspectjweaver</artifactId>
                    <version>${aspectj.version}</version>
                </dependency>
            </dependencies>
        </plugin>
        <plugin>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-maven</artifactId>
            <version>2.8</version>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.6.1</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>
    </plugins>
</build>

`

Use Class and Method Name in FileName

Please improve VideoRule.getFileName to save class name and method name if no video annotation is displayed.
We run >1000 Tests with 100 of classes and need more than just the method name. We do not use the @video annotation because we configure it globally for all tests.

Thanks,
and keep up the good work 👍

not work VideoRecorder.conf().videoEnabled(false) for RemoteVideoListener

How will Remote Hub learn that I have put in the test setup?
For local use it's the same code and the same class VideoConfiguration.class, but fot remote hub it's different Configuration class.

you do not look at the value enabled

Simple way in RemoteVideoListener
private boolean videoEnabled(Video video) { if (!VideoRecorder.conf().isVideoEnabled()){ return false; } return VideoRecorder.conf().getMode().equals(ALL) || (video != null && video.enabled()); }

or send configuration to hub

Trying remote recording (documentation problem)

Hi,
I'm trying the remote recording using the documentation example.

`@BeforeClass

public void setUp() throws Exception {

    URL hubUrl = new URL("http://localhost:4444/wd/hub");

    driver = new RemoteWebDriver(hubUrl, DesiredCapabilities.firefox());

    String nodeIp = GridInfoExtractor.getNodeIp(hubUrl, driver.getSessionId().toString());

    VideoRecorder.conf()

            .withRemoteUrl(nodeIp);

}`

It's seems that the documentation not updated.
In this example you used "withRemoteUrl" method that deprecated in the new version.

What should I replace it with?

And one more question, where the video file will be store using the remote mode?

Thanks,
Daniel.

Some times saving ffmpeg video is failing

Condition with lambda expression in com.automation.remarks.video.recorder.ffmpeg.FFMpegRecorder that uses java.io.File was not fulfilled within 5 seconds.
org.awaitility.core.ConditionTimeoutException: Condition with lambda expression in com.automation.remarks.video.recorder.ffmpeg.FFMpegRecorder that uses java.io.File was not fulfilled within 5 seconds.
    at org.awaitility.core.ConditionAwaiter.await(ConditionAwaiter.java:104)
    at org.awaitility.core.CallableCondition.await(CallableCondition.java:79)
    at org.awaitility.core.CallableCondition.await(CallableCondition.java:27)
    at org.awaitility.core.ConditionFactory.until(ConditionFactory.java:809)
    at org.awaitility.core.ConditionFactory.until(ConditionFactory.java:785)
    at com.automation.remarks.video.recorder.ffmpeg.FFMpegRecorder.waitForVideoCompleted(FFMpegRecorder.java:37)
    at com.automation.remarks.video.recorder.ffmpeg.FFMpegRecorder.stopAndSave(FFMpegRecorder.java:28)
    at com.automation.remarks.junit.VideoRule$1.recordVideo(VideoRule.java:45)
    at com.automation.remarks.junit.VideoRule$1.evaluate(VideoRule.java:31)
    at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
    at org.junit.rules.RunRules.evaluate(RunRules.java:20)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.runners.ParentRunner.run_aroundBody0(ParentRunner.java:363)
    at org.junit.runners.ParentRunner$AjcClosure1.run(ParentRunner.java:1)
    at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:221)
    at ru.d10xa.aspectj.AllureRunListenerAspect.run(AllureRunListenerAspect.java:28)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:359)
    at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:114)
    at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:57)
    at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:66)
    at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
    at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
    at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
    at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
    at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
    at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:109)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
    at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
    at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:377)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
    at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

Videos are corrupted, when using RecorderType.FFMPEG

OS: Windows 10
video-recorder-junit v1.4
JUnit 4.12

The ffmpeg.log gives following output:

[INFO ] 2017-03-01 20:45:51,596 com.automation.remarks.video.recorder.ffmpeg.FFMpegRecorder - Trying to execute the following command: [ffmpeg, -y, -video_size, 1366x768, -f, gdigrab, -i, desktop, -an, -framerate, 24, c:\Projects\scoro-site-creation\video\temporary_recording_2017_01_03_20_45_51.mp4]
[INFO ] 2017-03-01 20:46:13,312 com.automation.remarks.video.recorder.ffmpeg.FFMpegRecorder - Trying to execute the following command: [cmd, /c, for /f "tokens=2" %i in ('tasklist ^| findstr "ffmpeg"') do @echo %i]
[INFO ] 2017-03-01 20:46:13,941 com.automation.remarks.video.recorder.ffmpeg.FFMpegRecorder - Trying to execute the following command: [SendSignalCtrlC.exe, 13244]
[INFO ] 2017-03-01 20:46:16,116 com.automation.remarks.video.recorder.ffmpeg.FFMpegRecorder - Process kill output: Sending ctrl-c signal to process 13244...
(remote function) failed with 0xC0000005.
StartRemoteThread failed with 0xC0000005.
0xC0000005 == (FormatMessage failed)
[DEBUG] 2017-03-01 20:46:16,286 com.automation.remarks.video.recorder.ffmpeg.FFMpegRecorder - Recording output log: ffmpeg version 2.8.4 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 5.2.0 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
[gdigrab @ 03473c60] Capturing whole desktop as 1366x768x32 at (0,0)
Input #0, gdigrab, from 'desktop':
Duration: N/A, start: 1488393951.909601, bitrate: 1006131 kb/s
Stream #0:0: Video: bmp, bgra, 1366x768, 1006131 kb/s, 29.97 tbr, 1000k tbn, 29.97 tbc
No pixel format specified, yuv444p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 034756c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 034756c0] profile High 4:4:4 Predictive, level 3.2, 4:4:4 8-bit
[libx264 @ 034756c0] 264 - core 148 r2638 7599210 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=4 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'c:\Projects\scoro-site-creation\video\temporary_recording_2017_01_03_20_45_51.mp4':
Metadata:
encoder : Lavf56.40.101
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv444p, 1366x768, q=-1--1, 29.97 fps, 30k tbn, 29.97 tbc
Metadata:
encoder : Lavc56.60.100 libx264
Stream mapping:
Stream #0:0 -> #0:0 (bmp (native) -> h264 (libx264))
Press [q] to stop, [?] for help
frame= 22 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A dup=10 drop=0
frame= 38 fps= 36 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A dup=15 drop=0
frame= 55 fps= 34 q=29.0 size= 152kB time=00:00:00.10 bitrate=12459.4kbits/s dup=26 drop=0
frame= 154 fps= 31 q=29.0 size= 160kB time=00:00:03.40 bitrate= 384.2kbits/s dup=124 drop=0
frame= 218 fps= 31 q=29.0 size= 172kB time=00:00:05.53 bitrate= 254.3kbits/s dup=187 drop=0
frame= 259 fps= 31 q=29.0 size= 174kB time=00:00:06.90 bitrate= 206.3kbits/s dup=227 drop=0
frame= 283 fps= 31 q=29.0 size= 178kB time=00:00:07.70 bitrate= 189.1kbits/s dup=250 drop=0
frame= 299 fps= 31 q=29.0 size= 179kB time=00:00:08.24 bitrate= 177.8kbits/s dup=260 drop=0
Past duration 0.657433 too large
Past duration 0.632378 too large
Past duration 0.661186 too large
Past duration 0.661980 too large
Past duration 0.640160 too large
Past duration 0.640190 too large
frame= 314 fps= 31 q=29.0 size= 206kB time=00:00:08.74 bitrate= 192.9kbits/s dup=260 drop=0
frame= 329 fps= 31 q=29.0 size= 207kB time=00:00:09.24 bitrate= 183.1kbits/s dup=262 drop=0
frame= 345 fps= 31 q=29.0 size= 207kB time=00:00:09.77 bitrate= 173.8kbits/s dup=265 drop=0
frame= 361 fps= 31 q=29.0 size= 214kB time=00:00:10.31 bitrate= 169.9kbits/s dup=275 drop=0
frame= 376 fps= 30 q=29.0 size= 215kB time=00:00:10.81 bitrate= 162.6kbits/s dup=280 drop=0
frame= 395 fps= 30 q=29.0 size= 218kB time=00:00:11.44 bitrate= 155.9kbits/s dup=296 drop=0
frame= 425 fps= 30 q=29.0 size= 278kB time=00:00:12.44 bitrate= 182.7kbits/s dup=325 drop=0
frame= 457 fps= 30 q=29.0 size= 283kB time=00:00:13.51 bitrate= 171.5kbits/s dup=356 drop=0
frame= 500 fps= 30 q=29.0 size= 309kB time=00:00:14.94 bitrate= 169.4kbits/s dup=398 drop=0
frame= 526 fps= 30 q=29.0 size= 314kB time=00:00:15.81 bitrate= 162.7kbits/s dup=423 drop=0
frame= 543 fps= 30 q=29.0 size= 315kB time=00:00:16.38 bitrate= 157.7kbits/s dup=438 drop=0
frame= 558 fps= 30 q=29.0 size= 371kB time=00:00:16.88 bitrate= 179.9kbits/s dup=443 drop=0
frame= 573 fps= 30 q=29.0 size= 372kB time=00:00:17.38 bitrate= 175.1kbits/s dup=444 drop=0
frame= 592 fps= 30 q=29.0 size= 373kB time=00:00:18.01 bitrate= 169.5kbits/s dup=450 drop=0
frame= 610 fps= 30 q=29.0 size= 379kB time=00:00:18.61 bitrate= 166.8kbits/s dup=464 drop=0
frame= 625 fps= 30 q=29.0 size= 380kB time=00:00:19.11 bitrate= 162.7kbits/s dup=467 drop=0
[INFO ] 2017-03-01 20:46:16,286 com.automation.remarks.video.recorder.ffmpeg.FFMpegRecorder - Recording finished to: c:\Projects\scoro-site-creation\video\test_recording_2017_01_03_20_46_16.mp4
[INFO ] 2017-03-01 20:46:17,186 com.automation.remarks.video.RecordingUtils - No jenkins_url variable found.
[INFO ] 2017-03-01 20:46:17,189 com.automation.remarks.video.RecordingUtils - Video recording: c:\Projects\scoro-site-creation\video\test_recording_2017_01_03_20_46_16.mp4

The video is saved, but is I'm not able to play it (tried to open via browser and VLC). However, when I'm manually executing the command from the log:

ffmpeg -y -video_size 1366x768 -f gdigrab -i desktop -an -framerate 24 c:\Projects\scoro-site-creation\video\temporary_recording.mp4

The video can be played without any problems.

Recording error on Jenkins slave

Can you please look into this?

08:30:23 INFO -Trying to execute the following command: [cmd, /c, for /f "tokens=2" %i in ('tasklist ^| findstr "ffmpeg"') do @echo %i]
08:30:23 INFO -Trying to execute the following command: [SendSignalCtrlC.exe, ]
08:30:23 INFO -Process kill output: "" is not a valid PID.
0x00000057 == (FormatMessage failed)
08:30:23 DEBUG -Recording output log: ffmpeg version N-81784-g92de2c2 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 5.4.0 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-libebur128 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
libavutil 55. 30.100 / 55. 30.100
libavcodec 57. 58.100 / 57. 58.100
libavformat 57. 51.100 / 57. 51.100
libavdevice 57. 0.102 / 57. 0.102
libavfilter 6. 63.100 / 6. 63.100
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 2.100 / 2. 2.100
libpostproc 54. 0.100 / 54. 0.100
[gdigrab @ 0000000001c32cc0] Capturing whole desktop as 1920x1080x32 at (0,0)
[gdigrab @ 0000000001c32cc0] Failed to capture image (error 5)
[gdigrab @ 0000000001c32cc0] Could not find codec parameters for stream 0 (Video: bmp, none, 1988680 kb/s): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, gdigrab, from 'desktop':
Duration: N/A, bitrate: 1988680 kb/s
Stream #0:0: Video: bmp, none, 1988680 kb/s, 29.97 fps, 1000k tbr, 1000k tbn, 1000k tbc
Output #0, mp4, to 'D:\Jenkins\YO\workspace\Development\VideoEnroll\Framework\target\video\temporary_recording_2016_13_10_08_29_38.mp4':
Output file #0 does not contain any stream

shouldIntersept() method prevents video recording

As I understood, shouldIntersept() method inside VideoListener class is supposed to determine whether VideoListener class is present inside @listeners annotation on test class. But there are cases when listeners are added in different way. For instance, to testng.xml or through command line or even ServiceLoader. These cases are not taken into consideration. I personaly would like to make use of composition and add instance of VideoListener in my custom listener to call it when I need and I don't want to extend VideoListener because inheritance is not flefible.
I suggest to remove shouldIntersept() method or make it acknowledge all methods of adding listeners to tests.

Typo in method name withVideoSaveMove()

When I try to use VideoRecorder.conf().withVideoSaveMode(VideoSaveMode.FAILED_ONLY), I will receive error because withVideoSaveMode() method isn't realized. Instead of withVideoSaveMode() we have withVideoSaveMove() method. I think it's simple typo)

TestNG listeners conflict

Suppose, I have two testng listeners: 1) my own CustomListener which attaches recorded video to Allure, 2) VideoListener
Then these two listeners should be in direct order: VideoListener -> CustomListener in order to correctly stop video recording and only then attach in to Allure.
But in fact, testng doesn't guarantee that listeners will start in desired order and indeed 3 times of 5 CustomListener starts first when onTestFailure() invoked which leads to runtime error.
I solved this by instantiating VideoListener instance directly in CustomListener class so that I have control on what to call first but perhaps these is a way to find more elegant solution.

after test folder "video" don't remove

Need to create rule
"Try to delete folder video after test anyway passed or failed"

Now after test @test public void shouldBeAbsoluteRecordingPath() folder and video file exists

@After public void shutDown() throws IOException { FileUtils.deleteDirectory(conf().getVideoFolder()); }

I need to pass environment variable to video recorder process

I run my tests in XVFB (virtual display) and pass environment variable DISPLAY to chrome:

      ChromeDriverService service = new ChromeDriverService.Builder()
          .usingAnyFreePort()
          .withEnvironment(ImmutableMap.of("DISPLAY", ":80.3"))
          .build();

      ChromeDriver driver = new ChromeDriver(service, capabilities);

To save video from this browser, I need to pass the same DISPLAY env variable to video recorder too. It's ok to

Can't change path for the folder

On the latest version can't change path for the folder with video, using different ways like:

  1. In properties file:
    video.folder=${user.dir}/target/allure-results/videos;

  2. In POM.xml file:

<systemProperties>
	<property>
		<name>video.folder</name>
		<value>${user.dir}\allure\video</value>
	</property>
</systemProperties>
  1. In command line:
    -Dvideo.folder=${user.dir}/target/allure-results/videos

It always records in "video" folder within project folder.

Tested in JUnit5 with Maven, getting java.lang.AbstractMethodError

Hi,
First thanks for your great library.
It worked for me in JUnit4, so I gave it a try in JUnit5 with Maven,
using a simple code:
@Test @Video public void simpleTest() { System.out.println("Hello World"); }

And got the following error:

java.lang.AbstractMethodError: com.automation.remarks.junit.VideoExtension.beforeTestExecution(Lorg/junit/jupiter/api/extension/ExtensionContext;)V

Results :

Tests in error:
MavenTest.simpleTest » AbstractMethod com.automation.remarks.junit.VideoExtens...

at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

Caused by: org.apache.maven.plugin.MojoFailureException: There are test failures.

at org.apache.maven.plugin.surefire.SurefireHelper.reportExecution(SurefireHelper.java:91)
at org.apache.maven.plugin.surefire.SurefirePlugin.handleSummary(SurefirePlugin.java:318)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:880)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:739)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
... 20 more

Any idea about what it's related to?

*.avi video is recorded (instead of *.mp4) when RecorderType.FFMPEG is selected (Junit4)

.avi video is recorded (instead of .mp4) when RecorderType.FFMPEG is selected (Junit4)

OS: Windows 10, x64
FFMPEG: 3.3.2 (x64)

@rule
public VideoRule videoRule = new VideoRule();

@before
public void configuration() {
WebDriverRunner.clearBrowserCache();
Screenshots.screenshots.getScreenshots().clear();
VideoRecorder.conf().withVideoFolder("custom_folder")
.videoEnabled(true)
.withRecorderType(RecorderType.FFMPEG)
.withRecordMode(RecordingMode.ANNOTATED)
.withVideoSaveMode(VideoSaveMode.FAILED_ONLY);
}

`POM:

<groupId>test</groupId>
<artifactId>test</artifactId>
<version>0.1</version>

<properties>
    <allure.version>LATEST</allure.version>
    <selenide.version>LATEST</selenide.version>
    <aspectj.version>1.8.10</aspectj.version>
    <compiler.version>1.7</compiler.version>
    <video-recorder-junit.version>1.4</video-recorder-junit.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>

<dependencies>
    <dependency>
        <groupId>io.qameta.allure</groupId>
        <artifactId>allure-junit4</artifactId>
        <version>${allure.version}</version>
    </dependency>
    <dependency>
        <groupId>com.codeborne</groupId>
        <artifactId>selenide</artifactId>
        <version>${selenide.version}</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <version>1.7.21</version>
    </dependency>
    <dependency>
        <groupId>com.tngtech.java</groupId>
        <artifactId>junit-dataprovider</artifactId>
        <version>1.10.0</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.automation-remarks</groupId>
        <artifactId>video-recorder-junit</artifactId>
        <version>${video-recorder-junit.version}</version>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.20</version>
            <configuration>
                <testFailureIgnore>true</testFailureIgnore>
                <argLine>
                    -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
                </argLine>
                <properties>
                    <property>
                        <name>listener</name>
                        <value>io.qameta.allure.junit4.AllureJunit4</value>
                    </property>
                </properties>
                <systemProperties>
                    <property>
                        <name>allure.results.directory</name>
                        <value>${project.build.directory}/allure-results</value>
                    </property>
                    <property>
                        <name>allure.link.issue.pattern</name>
                        <value>https://jira.intetics.com/browse/{}</value>
                    </property>
                </systemProperties>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.aspectj</groupId>
                    <artifactId>aspectjweaver</artifactId>
                    <version>${aspectj.version}</version>
                </dependency>
            </dependencies>
        </plugin>
        <plugin>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-maven</artifactId>
            <version>2.8</version>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.6.1</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>
    </plugins>
</build>

`

Use a configuration file to customize ffmpeg startup options

It would be nice to use a configuration file (.properties) to be able to customize startup options when selected RecorderType.FFMPEG
INFO FFMpegRecorder:82 - Trying to execute the following command: [ffmpeg, -y, -video_size, 1600x900, -f, gdigrab, -i, desktop, -an, -r, 24, <file_name>]

video-recorder 1.1 enables DEBUG logs

video-recorder-core 1.1 contains file "log4j.properties" that automatically enables DEBUG logs.
I don't want it.
Some of my tests fail because of it.

Video not deleted with when FFMPEG recorder and FAIL ONLY mode

 VideoRecorder.conf().withVideoFolder("custom_folder")
                // Video could be disabled globally. Set to "true"
                .videoEnabled(true)
                .withRecorderType(RecorderType.FFMPEG)
                // There is two recording modes ANNOTATED AND ALL
                // Annotated is default and works only with methods annotated by @Video
                .withRecordMode(RecordingMode.ANNOTATED)
                .withVideoSaveMode(VideoSaveMode.FAILED_ONLY);

TestNG onTestSkipped() wrong behavior

This is current implementation of onTestSkipped() method.
public void onTestSkipped(ITestResult result) { this.onTestFailure(result); }
If I extend VideoListener with my own CustomListener, onTestSkipped() will call onTestFailure() method from CustomListener, not from VideoListener as expected. This is due to usage of 'this' reference in onTestSkipped() body.

Only temporary video files are created

I created with TestFx (testing JavaFX applications) a junit. I successfully created a recorded test with @video annotation before the @test. Everything is ok on the local machine. But when I am trying to run this junit from a Jenkins Job, on a virtual machine, (a Jenkins Slave Machine) I get the error message: "com.automation.remarks.video.exception.RecordingException: Condition with lambda expression in awinta.intellitax.MyCustomFFMpegRecorder that uses java.io.File was not fulfilled within 5 seconds. " There are created only some temporal files, but they can not be played.
temporary_recording_2018_17_04_15_19_56.mp4

I changed the interval from 5 seconds to 180 seconds...but still the error appears. Any idea?

Cannot run program "SendSignalCtrlC.exe": CreateProcess error=2, The system cannot find

While running same JUnit got below issue, all the steps is proper only
http://automation-remarks.com/video-recorder-java/#_ffmpeg_recorder_configuration

com.automation.remarks.video.exception.RecordingException: java.io.IOException: Could not execute [SendSignalCtrlC.exe, ""].
	at com.automation.remarks.video.SystemUtils.runCommand(SystemUtils.java:45)
	at com.automation.remarks.video.recorder.ffmpeg.FFmpegWrapper.killFFmpeg(FFmpegWrapper.java:70)
	at com.automation.remarks.video.recorder.ffmpeg.FFmpegWrapper.stopFFmpegAndSave(FFmpegWrapper.java:55)
	at com.automation.remarks.video.recorder.ffmpeg.FFMpegRecorder.stopAndSave(FFMpegRecorder.java:30)
	at com.automation.remarks.junit.VideoRule.stopRecording(VideoRule.java:68)
	at com.automation.remarks.junit.VideoRule.succeeded(VideoRule.java:37)
	at org.junit.rules.TestWatcher.succeededQuietly(TestWatcher.java:75)
	at org.junit.rules.TestWatcher.access$100(TestWatcher.java:46)
	at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:56)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.io.IOException: Could not execute [SendSignalCtrlC.exe, ""].
	at org.zeroturnaround.exec.ProcessExecutor.invokeStart(ProcessExecutor.java:987)
	at org.zeroturnaround.exec.ProcessExecutor.startInternal(ProcessExecutor.java:950)
	at org.zeroturnaround.exec.ProcessExecutor.execute(ProcessExecutor.java:890)
	at com.automation.remarks.video.SystemUtils.runCommand(SystemUtils.java:41)
	... 24 more
Caused by: java.io.IOException: Cannot run program "SendSignalCtrlC.exe": CreateProcess error=2, The system cannot find the file specified
	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
	at org.zeroturnaround.exec.ProcessExecutor.invokeStart(ProcessExecutor.java:977)
	... 27 more
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
	at java.lang.ProcessImpl.create(Native Method)
	at java.lang.ProcessImpl.<init>(ProcessImpl.java:386)
	at java.lang.ProcessImpl.start(ProcessImpl.java:137)
	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
	... 28 more

Не поддерживаются кастомные JUnit Rules

public class CustomWatcher extends org.junit.rules.TestWatcher{

    @Override
    protected void starting(Description test) {
        Screenshots.startContext(test.getClassName(), test.getMethodName());
    }

    @Override
    protected void failed(Throwable e, Description description) {
        AllureReportUtil.attachVideo();
    }

    @Override
    protected void finished(Description description) {
        Screenshots.finishContext();
    }
@Attachment(value = "video", type = "video/mp4")
    static byte[] attachVideo() {
        try {
            File video = VideoRecorder.getLastRecording();
            System.out.println("PATH: "+VideoRecorder.getLastRecording());
            return java.nio.file.Files.readAllBytes(java.nio.file.Paths.get(video.getAbsolutePath()));
        } catch (IOException e) {
            return new byte[0];
        }
    }

PATH: null

video is not saved to a custom folder when RemoteVideoListener is used

Steps:

  1. Add pom dependancy "video-recorder-testng".
  2. Add listener "@listeners(RemoteVideoListener.class)" & "@video" annotations to test classes.
  3. Setup custom video folder in "setUp()" method: with "System.setProperty("video.folder", "path")" or by "VideoRecorder.conf().withVideoFolder("path");"
  4. Run Hub & Node using video-recorder-remote-1.0.4.jar
  5. Run tests

Actual result:
Video is saved to default folder, not to custom.

If you will replace "@listeners(RemoteVideoListener.class)" with "@listeners(VideoListener.class)" - the video will be saved to a custom folder as expected.

So custom video folder setting works when "VideoListener.class" is used & doesn't work when "RemoteVideoListener.class" is used.

What is the best way to get absolute path to video

Hi!

I need to attach a link of path to video to allure.
So I need to get a path of it file.
From VideoListener I see that method:
File file = this.stopRecording(fileName);
But it is private...
What is best way to do that?

Jenkins MacOS salve black screen

Hello.
I have seen issues #26 and #48, I guess my situation is similar except using MacOS and Jenkins Agent.

So basically:
Jenkins agent is installed as LaunchAgent on MacOS in ~/Library/LaunchAgents/ and loaded on user login (and the user has AutoLogin enabled).

Android/iOS tests executed via Jenkins on this Jenkins Agent node. Resulting videos are black.
MacOS nodes can be accessed via MacOS native VNC Screen Sharing app.

Video record is blank when running tests from jenkins

step to reproduce:

  1. created a test using testng & video record
  2. run testng.xml using IDE = video record contain expected record
  3. run testng.xml using jenkins as executor = the video record for the last record is black (black screen was recorded instead of the test)

This means that I can't use video record when using Jenkins as executor.

Window recording using title="window_title" does not work

I'm trying to record just the browser window on Windows using FFMPEG. The below is video.properties file:

video.folder=E:\workspace_5_8\ALM_5_8\test\video
video.enabled=true
video.mode=ALL
#video.mode=ALL // default ANNOTATED
recorder.type=FFMPEG
video.save.mode=ALL
#video.save.mode=FAILED_ONLY
video.frame.rate=30
video.screen.size=900x900

#video.frame.rate=1 // default 24
#ffmpeg.format=x11grab // default value depends on OS platform
#ffmpeg.display=:0.0 // default value depends on OS platform
ffmpeg.display=title="APPNAME - Google Chrome"

However, I encounter 2 problems:

  1. because the video recorder always passes a video_size parameter to FFMPEG, I need to specify an explicit video.screen.size property that's smaller than the recorded screen. This is counterintuitive.

  2. The above problem is made even greater because the screenSize Recorder configuration property cannot be changed, it always is fixed to the dimensions of the current monitor. This is similar to the bug with the video folder fixed a couple of months ago, where the configuration doesn't actually use the property from the config file.

java.lang.NoSuchMethodError when using with Allure framework

I'm using yandex-allure framework with testNG, after adding videoRecorder to my test getting error on test run, see log below:

2016-07-09 23:11:21 INFO [InitDriver] Opening testUrl: https://_**/
2016-07-09 23:11:22 INFO [InitDriver] Window maximazed
Video recording
[E:_
\video\second_test_recording_2016_09_07_23_11_22.avi]

java.lang.NoSuchMethodError: ru.yandex.qatools.allure.config.AllureConfig.areTestNgParametersEnabled()Z

at ru.yandex.qatools.allure.testng.AllureTestListener.getName(AllureTestListener.java:233)
at ru.yandex.qatools.allure.testng.AllureTestListener.onTestStart(AllureTestListener.java:128)
at org.testng.internal.Invoker.runTestListeners(Invoker.java:1700)
at org.testng.internal.Invoker.runTestListeners(Invoker.java:1675)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:619)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
at org.testng.TestRunner.privateRun(TestRunner.java:782)
at org.testng.TestRunner.run(TestRunner.java:632)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319)
at org.testng.SuiteRunner.run(SuiteRunner.java:268)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1244)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1169)
at org.testng.TestNG.run(TestNG.java:1064)
at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:74)
at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:121)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

2016-07-09 23:11:25 INFO [InitDriver] Quiting driver

Without video recorder all works fine. Please assist.
My pom.xml


4.0.0

<groupId>***</groupId>
<artifactId>***</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
    <compiler.version>1.7</compiler.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <allure.version>1.4.24.RC2</allure.version>
    <aspectj.version>1.8.9</aspectj.version>
</properties>

<build>
    <defaultGoal>test</defaultGoal>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.19.1</version>
            <configuration>
                <testFailureIgnore>true</testFailureIgnore>
                <systemPropertyVariables>
                    <reporter.debug>false</reporter.debug>
                </systemPropertyVariables>
                <suiteXmlFiles>
                    <suiteXmlFile>${user.dir}/src/***.xml</suiteXmlFile>
                </suiteXmlFiles>
                <argLine>
                    -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
                </argLine>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.aspectj</groupId>
                    <artifactId>aspectjweaver</artifactId>
                    <version>${aspectj.version}</version>
                </dependency>
            </dependencies>
        </plugin>
        <plugin>
            <groupId>ru.yandex.qatools.allure</groupId>
            <artifactId>allure-maven-plugin</artifactId>
            <version>2.5</version>
            <configuration>
                <resultsDirectory>${project.build.directory}/allure-results</resultsDirectory>
                <reportDirectory>${project.build.directory}/allure-report</reportDirectory>
            </configuration>
        </plugin>
    </plugins>
</build>

<dependencies>
    <dependency>
        <groupId>ru.yandex.qatools.allure</groupId>
        <artifactId>allure-testng-adaptor</artifactId>
        <version>${allure.version}</version>
        <exclusions>
            <exclusion>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpcore</artifactId>
        <version>4.4.4</version>
    </dependency>
    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.9.10</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>2.53.1</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-firefox-driver</artifactId>
        <version>2.53.1</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-chrome-driver</artifactId>
        <version>2.53.1</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.7.19</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <version>1.7.19</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>1.7.19</version>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.17</version>
    </dependency>
    <dependency>
        <groupId>org.json</groupId>
        <artifactId>json</artifactId>
        <version>20151123</version>
    </dependency>
    <dependency>
        <groupId>com.codeborne</groupId>
        <artifactId>phantomjsdriver</artifactId>
        <version>1.3.0</version>
    </dependency>
    <dependency>
        <groupId>ru.yandex.qatools.ashot</groupId>
        <artifactId>ashot</artifactId>
        <version>1.5.2</version>
    </dependency>
    <dependency>
        <groupId>xml-apis</groupId>
        <artifactId>xml-apis</artifactId>
        <version>1.4.01</version>
    </dependency>
    <dependency>
        <groupId>com.automation-remarks</groupId>
        <artifactId>video-recorder-core</artifactId>
        <version>1.0.4</version>
    </dependency>
</dependencies>


<reporting>
    <excludeDefaults>true</excludeDefaults>
    <plugins>
        <plugin>
            <groupId>ru.yandex.qatools.allure</groupId>
            <artifactId>allure-maven-plugin</artifactId>
            <version>2.5</version>
            <configuration>
                <resultsDirectory>allure-results</resultsDirectory>
                <properties>
                    <allure.issues.tracker.pattern>https://***/%s</allure.issues.tracker.pattern>
                </properties>
            </configuration>
        </plugin>
    </plugins>
</reporting>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.