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
218 stars 65 forks source link

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

Open mario8x opened 7 years ago

mario8x commented 7 years ago

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

SergeyPirogov commented 7 years ago

Hm, but I don't see that you applied VideoListener. See TestNG example from readme

mario8x commented 7 years ago

I just add VideoListener in testsuite.xml file as below or i add Listeners annotation as example. The result will be the same:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >

<suite name="Automated test example">
    <listeners>
        <listener class-name="com.automation.remarks.testng.VideoListener"></listener>
    </listeners>
    <test name="Verify test video recording">
        <classes>
            <class name="vn.kms.ktaf.patest.tests.TestNgVideoTest">
                <methods>
                    <include name="shouldFailAndCreateRecordWithTestName"></include>
                    <include name="videoShouldHaveNameSecondTest">
                    </include>
                </methods>
            </class>

        </classes>
    </test>
</suite>
SergeyPirogov commented 7 years ago

Interesting case, need to look inside AbstractTestNGSpringContextTests and debug. I don't know why is it so.

mario8x commented 7 years ago

I will add log for you immediately test_with_abstract.log

@SergeyPirogov : please take a look at log file