App gets installed/launched for every test annotation in Amazon device farm - aws-device-farm

Iam not able to test a complete flow in device farm. All the tests run in sequence in local but in device farm, i see for every #test app gets launched from the beginning. I used below annotations in the code.
#BeforeSuite - to initialize the driver
#Test - for the test scripts
#AfterSuite - iam not quiting the driver

AWS Device Farm executes each #Test method individually. Each test method using a fresh instance of the Appium server and each one of these test methods is executed in a different Java process each time.

Related

Why do Selenium tests behave different on different machines?

I couldn't find much information on Google regarding this topic. Below, I have provided three results from the same Selenium tests. Why am I getting different results when running the tests from different places?
INFO:
So our architecture: Bitbucket, Bamboo Stage 1 (Build, Deploy to QA), Bamboo Stage 2 (start Amazon EC2 instance "Test", run tests from Test against recently deployed QA)
Using Chrome Webdriver.
For all three of the variations I am using the same QA URL that our application is deployed on.
I am running all tests Parallelizable per fixture
The EC2 instance is running Windows Server 2012 R2 with the Chrome browser installed
I have made sure that the test solution has been properly deployed to the EC2 "test" instance. It is indeed the exact same solution and builds correctly.
First, Local:
Second, from EC2 Via SSM Script that invokes the tests:
Note that the PowerShell script calls the nunit3-console.exe just like it would be utilized in my third example using the command line.
Lastly, RDP in on EC2 and run tests from the command line:
This has me perplexed... Any reasons why Selenium is running different on different machines?
This really should be a comment, but I can't comment yet so...
I don't know enough about the application you are testing to say for sure, but this seems like something I've seen testing the application I'm working on.
I have seen two issues. First, Selenium is checking for the element before it's created. Sometimes it works and sometimes it fails, it just depends on how quickly the page loads when the test runs. There's no rhyme or reason to it. Second, the app I'm testing is pretty dumb. When you touch a field, enter data and move on to the next, it, effectively, posts all editable fields back to the database and refreshes all the fields. So, Selenium enters the value, moves to the next field and pops either a stale element error or can't find element error depending on when in the post/refresh cycle it attempts to interact with the element.
The solution I have found is moderately ugly, I tried the wait until, but because it's the same element name, it's already visible and is grabbed immediately which returns a stale element. As a result, the only thing that I have found is that by using explicit waits between calls, I can get it to run correctly consistently. Below is an example of what I have to do with the app I'm testing. (I am aware that I can condense the code, I am working within the style manual for my company)
Thread.Sleep(2000);
By nBaseLocator = By.XPath("//*[#id='attr_seq_1240']");
IWebElement baseRate = driver.FindElement(nBaseLocator);
baseRate.SendKeys(Keys.Home + xBaseRate + Keys.Tab);
If this doesn't help, please tell us more about the app and how it's functioning so we can help you find a solution.
#Florent B. Thank you!
EDIT: This ended up not working...
The tests are still running different when called remotely with a powershell script. But, the tests are running locally on both the ec2 instance and my machine correctly.
So the headless command switch allowed me to replicate my failed tests locally.
Next I found out that a headless chrome browser is used during the tests when running via script on an EC2 instance... That is automatic, so the tests where indeed running and the errors where valid.
Finally, I figured out that the screen size is indeed the culprit as it was stuck to a size of 600/400 (600/400?)
So after many tries, the only usable screen size option for Windows, C# and ChromeDriver 2.32 is to set your webDriver options when you initiate you driver:
ChromeOptions chromeOpt = new ChromeOptions();
chromeOpt.AddArguments("--headless");
chromeOpt.AddArgument("--window-size=1920,1080");
chromeOpt.AddArguments("--disable-gpu");
webDriver = new ChromeDriver(chromeOpt);
FINISH EDIT:
Just to update
Screen size is large enough.
Still attempting to solve the issue. Anyone else ran into this?
AWS SSM Command -> Powershell -> Run Selenium Tests with Start-Process -> Any test that requires an element fails because ElementNotFound or ElementNotVisible exceptions.
Using POM for tests. FindsBy filter in c# is not finding elements.
Running tests locally on EC2 run fine from cmd, powershell and Powershell ISE.
The tests do not work correctly when executing with the AWS SSM Command. Cannot find any resources to fix problem.

how to run swift server single process

I'm trying to run a swift based web server using Kitura on Ubuntu.
This is following command to start hello word server.
.build/debug/helloworld
I can launch standalone process using .build/debug/helloworld &
but launching with that creates multiple process if execute again.
Or I've to kill old process then start new If I want to run only single process.
I've followed following tutorial to get server up running. But don't want to use Bluemix to deploy application. Instead I want to launch it on AWS ubuntu.
http://www.kitura.io/en/starter/gettingstarted.html
I assume there must be more easy and proper way to do this.
As you can see I'm almost newbie for servers.
You have to kill the Kitura process in order to stop a Kitura Server app - there is no other way to stop it.
If you just want to test your server you can run it inside a screen session. Screen is an essential utility for managing remote servers via ssh.
If you want to run it properly as a service/daemon you should look into systemd.

WindowsIdentity throwing a "There are currently no logon servers available to service the logon request"

The code below works fine when running from a Console C# application:
System.Security.Principal.WindowsIdentity wi = new System.Security.Principal.WindowsIdentity("User001");
but when I try to add it into a class inside my web application I get:
{There are currently no logon servers available to service the logon request}
at System.Security.Principal.WindowsIdentity.KerbS4ULogon(String upn)
at System.Security.Principal.WindowsIdentity..ctor(String sUserPrincipalName, String type)
at System.Security.Principal.WindowsIdentity..ctor(String sUserPrincipalName)
...
I am assuming this is related to Kerberos and since Web Applications run under an Application Pool I wonder if I need to register a SPN or do something extra here to get this to work(for the local Account).
The console app runs under my DOMAIN\USER001 and
the Web app (App Pool) runs under MY_LOCAL_MACHINE\USER001
so I am trying to verify if I need to run SetSPN.exe or not and what is the command line.
Thank you
I had the same issue in my 2008R2 VM running SP2010 with a backend WCF service. In the service I was calling
WindowsIdentity id = new WindowsIdentity("MyApplicationUser");
You need to make sure your NetLogon service is running. If you are running a VM, you will need to configure the DNS role in order for this service to start. Once I did this, my code worked.

Restarting service (declared in init.rc) from a system app in a Java context

I have a service declared in my init.rc on my platform that runs always, and an Android system app (signed with the platform keys) that is persistent (i.e. always runs), which communicate through TCP/IP.
At some point I would like to restarte the service from the app, the app runs under a defined system uid, however it does not have permission to call start or stop on the console, unfortunately.
I would like the app to restart the service, just like if I had executed the following in the console:
stop service
start service
Is there an android framework call I can make to restart a specific service?

Grails on STS: How to run >1 grails app simultaneously

The workspace consists of 2 projects. One is the main, user-facing, grails app, which runs on port 8080. The other is an admin app, also grails, by which all kinds of stuff for the main app is configured (and I'd like to get to run, simultaneous to the main app, on 8081).
I do not know how to get the two to run simultaneously (and have failed to find the answer via google). I want to do this, so that I could change stuff for the main app in the admin app, and test those changes in the main app, without constantly shutting down one in order to start the other.
I have tried setting the config.groovy parameter, for my local environment, to
grails.serverURL = "http://localhost:8081/admin-app"
(whereas the main app specifies grails.serverURL = "http://localhost:8080/main-app")
I have tried adding " -Dserver.port=8081" as a program argument in the run configuration for the admin app, but this does not do the trick.
My humblest thanks to the eclipse/STS guru who has the answer to this problem.
You should not add the server.port as a program argument. It needs to be a vm argument.
VM arguments are added on the arguments tab:
So, should be added on the bottom, not the top.