Ask a Question

Unable to create a user session - Error in Jenkins

SOLVED
Shehnaz
Occasional Contributor

Unable to create a user session - Error in Jenkins

I am trying to run Test Complete projects as a Freestyle Project on Windows server using Jenkins that is installed on the same sever.

Getting below Jenkins error –

 

Console Output

Started by user Shehnaz Patanwala

Running as SYSTEM

Building in workspace C:\Program Files (x86)\Jenkins\workspace\Test Complete

 

[TestComplete] The test execution started (PITA_Internal/C:\Users\Public\Install\pita-ui-automation-projects\PITA_Internal\A-Account_Reset_Project\A-Account_Reset_Project.mds).

[TestComplete] Found TestComplete/TestExecute installations:

        Type: TE, Version: 14.10.1042.11, Path: "C:\Program Files (x86)\SmartBear\TestExecute 14\x64\bin\TestExecute.exe"

[TestComplete] Selected TestComplete/TestExecute installation:

        Type: TE, Version: 14.10.1042.11, Path: "C:\Program Files (x86)\SmartBear\TestExecute 14\x64\bin\TestExecute.exe"

[TestComplete] Launching the test runner.

$ '"C:\Program Files (x86)\SmartBear\TestExecute 14\bin\TestCompleteService14.exe"' //LogonAndExecute //lDomain: "" //lName: "" //lPassword: ******** //lTimeout: "-1" //lUseActiveSession: "true" //lCommandLine: '""C:\Program Files (x86)\SmartBear\TestExecute 14\x64\bin\TestExecute.exe" C:\Users\Public\Install\pita-ui-automation-projects\PITA_Internal\PITA_Internal.pjs /run /SilentMode /ForceConversion /ns /exit "/ExportLog:C:\Program Files (x86)\Jenkins\workspace\Test Complete\1571766356292.tclogx" "/ExportLog:C:\Program Files (x86)\Jenkins\workspace\Test Complete\1571766356292.htmlx" "/ErrorLog:C:\Program Files (x86)\Jenkins\workspace\Test Complete\1571766356292.txt" /project:C:\Users\Public\Install\pita-ui-automation-projects\PITA_Internal\A-Account_Reset_Project\A-Account_Reset_Project.mds /DoNotShowLog /JenkinsTCPluginVersion:2.3"'

[TestComplete] Test runner exit code: -10 (Unable to create a user session).

[TestComplete] [WARNING] Unable to find the log file "1571766356292.tclogx".

[TestComplete] [WARNING] Unable to find the log file "1571766356292.htmlx".

[TestComplete] [WARNING] Errors occurred during the test execution.

[TestComplete] Marking the build as UNSTABLE.

[TestComplete] [WARNING] Unable to publish test results (xml data is empty).

[TestComplete] The test execution finished (PITA_Internal/C:\Users\Public\Install\pita-ui-automation-projects\PITA_Internal\A-Account_Reset_Project\A-Account_Reset_Project.mds).

Build step 'TestComplete Test' changed build result to UNSTABLE

Finished: UNSTABLE

 

 

Looks like it’s failing because of not creating a User Session. I have configured my workstation accordingly. Only thing that's missing in Jenkin step is creating a node and cofiguring Jenkins slave agent runs as a service. 

Is this a required step to run freestyle job on the server locally?

13 REPLIES 13
Wamboo
Community Hero

Hi,


Yesterday i had the same error working with Jenkins and we notice that we needed to configure Jenkins slave exactly on the user You are trying to use with Jenkins slave service.


So, did you configure the Jenkins slave on the user which You are trying to use with Jenkins?

 

Ore there is a few configure checboxes to set up before run slave job, like "use active session" etc.

AlexKaras
Champion Level 2

Hi,

 

https://support.smartbear.com/testcomplete/docs/working-with/automating/session-creator/index.html might help as well.

 

Regards,
  /Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
TanyaYatskovska
SmartBear Alumni (Retired)

Thanks for your suggestions, AlexKaras, Wamboo.

 

@Shehnaz, do the suggestions help you resolve the issue?

 

 

 

 

 
---------
Tanya Yatskovskaya
SmartBear Community and Education Manager




Hi @Shehnaz 

I have the same Error message.

I didn't find answer on community so I recently open a case to the smartbear Support Team.


Our Jenkins Master is based on another server, that seems to be the only difference with you issue.

 

My Agent si installed as a service
His name is : jenkinsslave-G__jenkins_workspace

The windows service is set to run as "local service account" with "allow service to interact with desktop" checked.

I launch my tests and I have the Jenkins message ending with :

[TestComplete] Test runner exit code: -10 (Unable to create a user session).
... [TestComplete] Marking the build as FAILED.

 

Did you find a solution ?

Nikolayev
Contributor

...  @Shehnaz    Ho   ..  I see that after my first answer : the user name is empy in your Jenkins Job   "  /lName: "" . Maybe you remove  it voluntarily ?

Hi,

 

service is set to run as "local service account" with "allow service to interact with desktop" checked.

To my knowledge, this setting allows service to display message boxes visible on the current desktop, but does not make service capable to create interactive user session.

The best solution (if not the only possible one) is to set Jenkins slave to run as an application within the user session. (Yes, you must ensure session's existence first.)

 

Regards,
  /Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
sonya_m
SmartBear Alumni (Retired)

Hi @Nikolayev, have you tried what Alex is suggesting?


Sonya Mihaljova
Community and Education Specialist

Hi Alex, Thank you for this.

 

" .... set Jenkins slave to run as an application within the user session".

I need to understand what you mean regarding what it is possible to do with Windows Server 2016.

Actually, the slave Jenkins node is set to use a Windows Service called "jenkinsslave-G__jenkins_workspace" 

It don't works so you mean that I can try  another way to call what  "jenkinsslave-G__jenkins_workspace" do ?

 

You mean I have to create a application called "jenkinsslave-G__jenkins_workspace"  with the JAR.

And then launch it on the server ?

how can I launch this if no user session is open ?  

 

turn 

 

 

 

Actually, the slave Jenkins node is set to use a Windows Service called "jenkinsslave-G__jenkins_workspace" 

 

 

 

Hi,

 

how can I launch this if no user session is open ?  

Well...

-- In order for TestComplete (TestExecute, QTP, even Selenium) to be able to interact with the GUI of the tested application, this tested application must render its UI;

-- In order for the Windows application to be able to render its UI, it must have a desktop assigned to it;

-- In order for the application to have a desktop assigned to it, some user must be logged-in interactively and have active not locked user session.

 

So, if no user is logged-on interactively, there will be no active user session, there will be no desktop and the application started on behalf of this user (or any system account that does not have active user session with the desktop either) will not be able to render its UI. Thus test automation software will not be able to drive application's UI just because it is absent. Point.

 

For the GUI applications, slave Jenkins setup is usually like this:

-- slave box is configured to login automatically under some dedicated user;

-- This ensures active not locked user's session with desktop;

-- Scheduled task is set up to start Jenkins slave application on user logon;

-- This ensures that a) Jenkins master will be able to communicate with the slave; and b) that the application (TestComplete in our case) will be started by the slave within this user session;

-- Then TestComplete starts the tested application (again, within the user session that has desktop assigned), tested application obtains desktop where it can render its UI and thus TestComplete gets a possibility to drive the tested application via UI.

 

Impossibility to render UI if no desktop is assigned to user session is fundamental Windows OS behavior but not a limitation of TestComplete.

 

https://wiki.jenkins.io/display/JENKINS/Step+by+step+guide+to+set+up+master+and+agent+machines+on+Wi...

https://support.smartbear.com/testcomplete/docs/working-with/integration/jenkins/preparing.html

might help.

 

Regards,
  /Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
cancel
Showing results for 
Search instead for 
Did you mean: