Get Test Instance Names from test set folder in Java using API - java

I am trying to get the test instance names from the test set. I am able to get the test id by using the following URL:
"rest/domains/"+domain+"/projects/"+project+"/test-instances?query={cycle-id["+testSetId+"]}" ;
Is there any way I can get the test names also?

I guess you're talking about the ALM Rest API.
If you do, you can try to add in final of your URL the following:
&fields=test-config.name
Then your URL will look like this:
rest/domains/{domain}/projects/{project}/test-instances?query={cycle-id[{testSetId}]}&fields=test-config.name
The name of your Test Instance will be shown into the RelatedEntities tag from your XML.
For more information about ALM REST API you can click here.

Related

How to generate Kibana links with Java?

I would like to write a Java class which generates URLs for Kibana 4.5.4.
For example, I would like to add multiple queries like
query:(match:(my_tags:(query:TEST,type:phrase))))
and something like
_g=(filters:!(),refreshInterval:(display:Off,pause:!f,value:0),time:(from:now-1y,mode:quick,to:now))
The final URL should look like:
https://mykibanaserver/kibana/app/kibana/?_g=(...)&_a=(....)
Is there any documentation/specification of the URL format or any Java API for this?
Note that I do not want to make a REST call but generate the URL as string!
There is no documentation for Kibana URL, and no API.
To perform the build of our URLs, we make some POJO for G and A wich contain the diferents properties as attriutes of the class.
Then you can build the URL with it.

Serenity + Rest services

I am trying to demo serenity with Restassured at my workplace here and show them how awesome and easy it is to use in comparison to using jasmine.js
How ever I am stuck with few things in the basic test I am trying to do
My test says
Given we have valid credentials for the client using this test
When we try to serach for a medicine '<medicine>'
Then we get a valid '<perfLabel>' response with search results
|medicine|perflabel|
|Salbutamol|perflabel1|
|Panadol|perflabel2|
|Salbutamol (GA)|perflabel3|
When I go into the next step
#When("we try to serach for a medicine '(.*)' ")
public void tryToSearchUsingEquals(String medicine)
{
tsApiActions.requestServiceSearchWhichEquals(medicine);
}
In my Step method
#Step
public void requestServiceSearchWhichEquals(String medicine)
{
host = "http://www.int.abc.com.au/api/cs/v1/terminology-service/trade-product/search-summary?offset=0&limit=20&prefLabel=eq "+medicine+"&sort=prefLabel DESC&cache=false";
requestSend(host);
}
The questions I have are
How do i inject the variables(Salbutamol, Panadol) into the uri?
How do I put this URI into a seperate properties file and call it in the Step method?
Any help is really appreciated
Thanks
RestAssured requests follow the same code structure which should be added into your sendRequest method:
given().
param("prefLabel", medicine).
when().
get(URL).
then().
body(containsString(medicine));
URL can come from property file, but you need to create a method to upload it before test run and then you have to create a getPropety() method to get the current value you need.
I suggest to read the official documentation here:
https://github.com/rest-assured/rest-assured

How to read the REST request in soapui using java/groovy

For Example:
REST Request
I want to read these REST matrix request using Java or groovy.
What could be the possible solution?
You need to check where they are the properties.
You review the attachment.
Show properties
You follow this steps:
Create a testSuite with the testcase.
Add the activity Groovy script and you add this code.
//Print all properties
log.info testRunner.testCase.getTestStepByName('NAME_TESTSTEP').getPropertyList().name;
log.info testRunner.testCase.getTestStepByName('NAME_TESTSTEP').getPropertyList().value;
//Get value propertie
def value_property = testRunner.testCase.getTestStepByName('NAME_TESTSTEP').getPropertyValue('NAME_PROPERTY');
//Print Get value propertie
log.info value_property
//Set value Property
testRunner.testCase.getTestStepByName('NAME_TESTSTEP').setPropertyValue('NAME_PROPERTY','VALUE');
You need to update the values (NAME_TESTSTEP ,NAME_PROPERTY ,VALUE)
Run the grrovy script.

Appium driver to get app package name programmatically

I am using:
appiumDriver.findElement(By.id("com.XXX.keyword:id/nextButton"));
but sometimes we have debug version, so we have something like "com.XXX.keyword.debug". So I want to get package name before test runs so the tests can be independent on this.
I tried
driver.currentActivity()
but it only returned something like ".MainActivity"
Is there any way to get package name with Appium?
Thanks a lot.
You don't need package name to locate elements. Simply copy paste id without package name . eg in your case use only 'nextButton' instead of 'com.XXX.keyword:id/nextButton'
To get the current package name use following method:
driver.getCurrentPackage();
The following statement you are using will give you Activity Name.
driver.currentActivity();

How to reverse route to an action from my form in Play Framework 2.3

Good day Everyone,
I am new to Play framework and am trying to get started building an application. Under the app/controllers folders i have created sub packages so i have something like app/controllers/products/ProductController.class.
In my routes.conf file i have added a sample route like this
GET /createproduct controllers.products.ProductController.listAllProducts()
POST /createproduct controllers.products.ProductController.createProductDetail()
and i can goto the url http://localhost:9000/createproduct and see a sample view that i created.
My issue now is that i want to add a form to the view and when i try to use the form helper method to POST data to the POST URL above from my new view like this
#helper.form(action = routes.products.ProductController.createProductDetail()) {
i get the error that
value products is not a member of object controllers.routes
All the samples that i saw online only use the route.Application example which is doesnt fit my issue.
So my question is how do i reverse route to this action or route from a view using the Form helper
The valid syntax is:
[full-package-name].routes.[controller].[method]
So in your case it should be
controllers.products.routes.ProductController.createProductDetail()
controllers.routes is imported implicity, therefore for using with controllers in default package you can short it to:
routes.Controller.action()

Categories

Resources