So I think you found the problem there, the tests are failing because as 
expected it was unable to capture a screen or Window. My guess is that your 
test suite is failing but is then not cleaning up the programs that it 
spawns. Thus Ansible still thinks it is running (because the programs are 
still open) and will continue to wait until that is not the case. Hopefully 
you can ammend you test suite to kill the processes that it spawns.

As for the error about not capturing the screen I think you will be mostly 
out of luck. There are 2 things I think you can do if you still want to go 
down the route of automated testing but they are not pretty. Basically what 
I think you can do is set up the host to auto login as a local user on 
reboot that then runs your test suite. You can either set the tests to run 
on login automatically or get Ansible to spawn them but I think the former 
will be easiest.

Here is what a basic workflow may look like (I have not tested this so it 
probably needs some tweaks):

- name: Set the host to auto logon on reboot
  win_regedit:
    path: HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
    name: '{{ item.name }}'
    data: '{{ item.value }}'
    type: '{{ item.type }}'
    state: present
  with_items:
  - name: DefaultUserName
    value: local user
    type: string
  - name: DefaultPassword
    value: user password
    type: string
  - name: AutoAdminLogon
    value: 1
    type: dword

- name: Set test suite to run on next logon
  win_regedit:
    path: HKLM:\SOFTWARE\Microsoft\Windows\RunOnce
    name: RobotTesting
    data: C:\Windows\System32\cmd.exe /c C:\dev\project\tests\functional\
robotstart.bat test_start.robot
    type: string
    state: present

- name: Reboot the Windows host to kick off the tests
  win_reboot:

# We first need to get the PID before we can wait for it to finish
- name: Find the pid of the process
  win_wait_for_process:
    process_name_exact: robot
    state: present
  register: process_info

- name: Wait for the tests to complete
  win_wait_for_process:
    pid: '{{ process_info.matched_processes[0].pid }}'
    state: absent
    timeout: 600  # 10 minutes, set to what you need

# INSERT TASKS TO GET TEST RESULTS AND ASSERT SUCCESS HERE
# INSERT CLEANUP REGISTRY TASKS HERE

If you want Ansible to spawn the tests directory you can but you will need 
to do 2 things;

* Get the Session Id of the logged in user, this should be 1 but that may 
not be the case in all scenarios
* Use psexec with `-s -i <session id>` to run the program on the desktop of 
the session specified


Hopefully this helps you further and good luck with it all.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/178aff8c-48c7-4a5a-8b82-4bffb5f4b1f5%40googlegroups.com.

Reply via email to