Forum Discussion

egiacomi's avatar
egiacomi
Contributor
6 years ago

VideoRecorder Problem

Hi,

I want to recording my tests and I use this extension : https://github.com/SmartBear/testcomplete-videorecorder-extension .

I start and stop the Video through event management (OnStartTest And OnStopTest) , in some test  when I stopped the VideoRecorder the call to the method VideoRecorder.Stop()  enter an infinite loop .

if i don't find a solution in a short time i'm thinking to use another technology to record video .

There are any bugs on this extension?

Anyone know a solution to this problem ?

 

Best Regards

 

Emanuele

 

  • I use VideoRecorder as well, but I have never experienced any issues with infinite loops.  I don't start the videorecorder in the OnStartTest event though. I manually call a script from my KWTs, since I don't want to always record everything.  I use the OnStopTest as a fallback in case I forgot to call the script to stop at the appropriate point of the KWT

     

    I can't help but notice - and this is probably not the casue - that you code will ALWAYS reach if(!VideoRecorder.IsRecording(), since you previous if statement includes "or True", which means your if statement will always equate to true.  You may want to change that

     

    My OnStopTest looks like so:

     

    function GeneralEvents_OnStopTest(Sender)
    {
    if(VideoRecorder.IsRecording())
      VideoRecorder.Stop();
    }

    There are then two differences I can see.

    1. I don't use OnStartTest to start my recording.  Does that mean it's your OnStartTest that is somehow starting the VideoRecorder again in a loop ?

    2.  I work in Jscript.  Can't see how that would make any difference and how you could test if this is the cause.

  • Bobik's avatar
    Bobik
    Frequent Contributor

    Make sure that folder that you use for video exists.

    Do you have any errors or warnings in log?

  • AGubarev's avatar
    AGubarev
    SmartBear Alumni (Retired)

    Hi, there is infinitive loop?

    What do you see on screen? Maybe some text in indicator.

    How long is your test? Maybe if it's too long it's better to create shorter videos for different parts of the test.

    It'd be perfect to reproduce the issue with manual closing with --one-instance vlc://quit: to do this, instead of closing via event just run vlc.exe from cmd.exe with it's full path with such command line. Maybe you can see some errors inside cmd.exe winow. In this case, please, post them here

    • egiacomi's avatar
      egiacomi
      Contributor

      Now i try to replicate the problem , it isn't easy to replicate bacause is random .

      If i have success to replicate it , I'm going to see cmd window 

  • Edit:   Modified code included when I realised there are some pieces of code in there that won't apply to this situation or contribute to identifying the issue :smileyhappy:

     

    If it is in fact a case of something calling the OnStartTest and OnstopTest in a loop, what does you OnStartTest look like ?  Is that also doing a check if the videorecorder is running ?

     

    I have a wrapper script for starting the VideoRecorder, which included a check if the ViseoRecorder is already Recording before trying to start.  What do you see if you put a log entry inside the OnTestStart and OnTestStop ? Is it indeed looping through events or is it internal to the VideoRecorder.Stop();

     

     

    function GeneralEvents_OnStopTest(Sender)
    {
    Log.Message("Check if recorder is running before stop
      if(VideoRecorder.IsRecording())
    {
    Log.Message("Trying to stop videorecorder");
      VideoRecorder.Stop();
    } 
    
    // in a VideoRecorder script tunit:
    
    function Start(filename,quality)
    {
      if(!ProjectSuite.Variables.LogVideo)
      return;   
    
    Log.Message("Check if recorder is running before start");
    //This check should ensure you don't keep restarting it in some loop. You may get the logging multiple times though, which is a giveaway of the events looping
      if(!VideoRecorder.IsRecording())
      {    
    Log.Message("Try start recorder");
        VideoRecorder.Start(quality,null,fileName);
      }
    }
    
    function GeneralEvents_OnStartTest(Sender)
    {
     VideoRecorderScript.Start("myfilename","low");
    }

     

     

    • egiacomi's avatar
      egiacomi
      Contributor

      The looping is internal the VideoRecorder.Stop().

      If i kill vlc.exe the Tests execution doesn't go on .

      In my code i check if the folder exists.

       

      This is the code od my OnStartTest :