I am trying to mock Appium’s behavior using WireMock.
Problem I am facing is: my POST stub is able to respond me with the response code I have set (which I have monitored using Wireshark), but it is throwing exceptions related to session creation.
POST stubs I have tried for creating session for reference:
- Trial 1:
wireMockRule.stubFor(post(urlEqualTo("/wd/hub/session”)).
withRequestBody(matching(“JSON representation of set of desired capabilities specific to application"))
.willReturn(aResponse().
withStatus(200).
withHeader("Content-Type", "application/json”).
withBody("{\"sessionId\":\"e523dc70-c068-46e7-b966-8462401119b4\",\"status\":0,\"value\":\"Created Session\"}")));
Outcome: “It is impossible to create a new session because 'createSession' which takes HttpClient, InputStream and long was not found or it is not accessible” exception.
Trial 2: Just removed request body from above stub
wireMockRule.stubFor(post(urlEqualTo("/wd/hub/session”))
.willReturn(aResponse().
withStatus(200).
withHeader("Content-Type", "application/json”).
withBody("{\"sessionId\":\"e523dc70-c068-46e7-b966-8462401119b4\",\"status\":0,\"value\":\"Created Session\"}")));
Outcome:
org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session” exception.
Environment reference:
Java-client of Appium: 6.0.0
Selenium standalone server: 3.12.0
Selenium client of Java: 3.12.0
Please help.
This does not really seem to related to WireMock?
Maybe you can switch to the .NET version from WireMock to simulate your calls?
Related
I am trying to execute a feature with 3 scenarios in it using:
Results results = Runner.parallel(tagQuery, featurePaths, null, new ArrayList<>(), 3, karateOutputPath);
With #parallel=false works fine however when I removed, it fails with the following error:
com.intuit.karate.exception.KarateException: test_input.feature:50 - driver config / start failed:
org.apache.http.conn.HttpHostConnectException: Connect to localhost:9222 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect, options: {type=chrome, target=null}
This occurs at the * driver <url> phase. This is an intermittent failure which most of the time 2/3 scenarios pass and one fails with this error.
Version: 0.9.6.RC3
I recommend using Zalenium like Remote Browser Grid to achieve parallelism and make sure that your scenario are self-contained or atleast keep feature independent.
Sorry, running browser tests in parallel is non-trivial which is why we have the Docker option.
EDIT: and in case you landed here because you wanted karate.callSingle() to work for UI tests, sorry that is not possible as well. But you are encouraged to perform an API sign-in via karate.callSingle() and then speed up your UI tests: https://github.com/intuit/karate/tree/develop/karate-core#hybrid-tests
Consider that this is not supported on a single node. It can be made to work if you know what you are doing, but you need to figure this out depending on whether you are using Chrome or WebDriver.
Please refer the docs: https://twitter.com/ptrthomas/status/1159295560794308609 | https://github.com/intuit/karate/tree/master/karate-core#configure-drivertarget
EDIT - also see this answer: https://stackoverflow.com/a/60387907/143475
I want to sync automation result from jenkins to testlink. I tried with Testlink -jenking plugin and testlink-api-client but not worked getting error.
Pre-setup :
$tlCfg-> api-> enabled
$tlCfg-> exec_cfg-> enable_test_automation
From Testlink UI enable automation for the project.
Test code :
TestLinkAPIClient testlinkAPIClient = new TestLinkAPIClient(APIKEY, "http://localhost/testlink/lib/api/xmlrpc/v1/xmlrpc.php");
testlinkAPIClient.reportTestCaseResult(Project, TestPlan, TEST_CASE, Build, notes/comments, teststatus);
output :
"testlink.api.java.client.TestLinkAPIException: The call to the xml-rpc client failed.".
References used :satishjohn.wordpress.com
2. softwaretestinghelp.com
and other stackoverflow threads.
I browsed and try out defined steps from some of the blogs but still facing same issue?. Can anyone help me to resolve this issue or other approach on sync result with testlink ?.
I believe you should follow the documentation(1) written by kino who wrote the plugin.We recently managed to sync automation results from Jenkins to Testlink by following above doc.Our auto tests were written based on testng framework, Hence we used "testng-results.xml" and TestNg method name based result seeking strategy.
We didn't come across an issue as you mentioned. From (2) and (3) you can get the plugin source .My advice is to debug the code after enabling the debug on Jenkins hosted tomcat server. So you can find the actual cause of the issue by yourself.
Reference:
(1) https://wiki.jenkins-ci.org/download/attachments/753702/jenkins.pdf
(2) https://github.com/jenkinsci/testlink-plugin
(3) https://github.com/kinow/testlink-java-apienter code here
You can run wireshark and filter on port "tcp port http" to see exact error you get from the server. When it was not working for us we were getting 200 OK with text "XML-RPC server accepts POST requests only."
You can also check /var/log/apache2/error.log for testlink errors.
We fixed the issue by setting following config in config.inc.php and restarting apache.
$tlCfg->api->enabled = TRUE;
$tlCfg->exec_cfg->enable_test_automation = ENABLED;
We recently migrated to Spring boot 1.3.1 from the traditional spring project.
Our existing clients use Tyrus 1.12 as a websocket client.
After the upgrade, we found that the clients no longer connect and throws AuthenticationException. Strangely, they are able to connect for the first time since server restart and soon after throws AuthenticationException.
Digging a bit more, I found that Tyrus receives a 401 initially and passes on credentials subsequently. The server logs indicate the same behaviour, by first assigning ROLE_ANONYMOUS and then the correct role, ROLE_GUEST there after.
It seems like after the negotiation, the server closes connection and disconnects.
I observed the same behaviour when using spring stomp websocket client with Tyrus.
ClientManager container = ClientManager.createClient();
container.getProperties().put("org.glassfish.tyrus.client.sharedContainer", true);
container.getProperties().put(ClientProperties.CREDENTIALS, new Credentials("guest", "guest"));
StandardWebSocketClient webSocketClient = new StandardWebSocketClient(container);
final CountDownLatch messageLatch = new CountDownLatch(10);
WebSocketStompClient stompClient = new WebSocketStompClient(webSocketClient);
This same server setup works fine when the credentials are sent in the header.
stompClient.connect(url, getHandshakeHeaders("guest", "guest"), handler);
And this will NOT work since the credentials are not in the header
ListenableFuture<StompSession>session = stompClient.connect(url, handler, "localhost", "8080");
I am not understanding why it is working one way and not the other.
After upgrading to spring-boot, our software is no longer backwards compatible and will have to ask all our external clients to inject the authorization in the header before receiving a 401.
Can someone please help?
My earlier post with stacktrace
I am trying to unit test message handlers for NServiceBus 4.0.4. The bus is configured to use JSON serializer in the application using the Configure.Serialization.Json(); method call.
Whenever I call the Test.Initialize() method from the unit tests assembly I get the following exception: System.Configuration.ConfigurationErrorsException : Multiple serializers are not supported. Please make sure to only enable one
I tried calling Configure.Serialization.Json() and Serializers.SetDefault<JsonSerialization>() before calling the Test.Initialize() method without any success.
Does anyone know what am I doing wrong? All examples I see on the internet do not mention any Configure calls.
This issue has been reported previously here and looks like it will be fixed in the next NServiceBus build (both 4.0.5 and 4.1.0)
A workaround is to explicitly disable the xml serializer when enabling the json one.
Configure.Serialization.Json();
Feature.Disable<XmlSerialization>(); // hack to make NSB unit tests work
My code is consistently generating the following error:
org.apache.axis2.AxisFault: Timeout waiting for connection
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:203)
at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:76)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:400)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:225)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:435)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:402)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
After extensive searching the solution appears to be here:
http://amilachinthaka.blogspot.com/2009/05/improving-axis2-client-http-transport.html
Except I cannot access http client directly (that is done in auto generated code).
Instead I have tried:
http://wiki.apache.org/ws/FrontPage/Axis/AxisCommonsHTTP
Which seems to help slightly. However it only delays the problem I always get the timeout. Also the instructions appear to be for an old version of Axis since Axis2 does not have AxisProperties. I am using version 1.5.1. Any suggestions?
I think this was a bug, see here and has been fixed with Axis2 1.5.2 (at least for generated code). With custom code, you need to tackle this problem manually.