video-recorder-java icon indicating copy to clipboard operation
video-recorder-java copied to clipboard

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

Open mario8x opened this issue 8 years ago • 4 comments

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

mario8x avatar Sep 24 '17 06:09 mario8x

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

SergeyPirogov avatar Sep 24 '17 07:09 SergeyPirogov

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>

mario8x avatar Sep 24 '17 07:09 mario8x

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

SergeyPirogov avatar Sep 24 '17 07:09 SergeyPirogov

I will add log for you immediately test_with_abstract.log

@SergeyPirogov : please take a look at log file

mario8x avatar Sep 24 '17 07:09 mario8x