Is it possible to use #Issue annotations to impact the category a test appears as inside an Allure report? - allure

Is it possible to use #Issue annotations to impact the category a test appears as inside an Allure report?
I would like tests with an #Issue annotation to show in "Product Defects" and those without to appear in "Test Defects".
#Issue("JIRA-1234")
public void productDefect() {
// Test which fails and should be categorised as product defect
}
The Allure documentation on categories doesn't show a way of doing this. Is there a way of controlling the category based on on the issue annotation or is is exclusively the test error message/stack trace?
If this isn't possible out of the box, is there a workaround to easily achieve this behaviour?

This doesn't appear to currently be possible, but there is an open request for the feature on GitHub.

Related

Using the Python API is there anyway to get the Test Run's Status?

I currently have a python program which exports Test Runs, Test Plans, and Test Cases to CSV.
I am using the TestRun Model but I cannot get the information highlighted in the status column seen here. Is there anyway to get this information?
Thanks!
I currently have a python program which exports Test Runs, Test Plans, and Test Cases to CSV.
This is great. Please consider contributing your script under https://github.com/kiwitcms/api-scripts
I am using the TestRun Model but I cannot get the information highlighted in the status column seen here. Is there anyway to get this information?
Note: these screenshots are old!
There is no TestRun.status field, the status is only a visual property which is calculated by the UI based on the presence or absence of TestRun.stop_date field. If this field is null/None then the status is "Running", otherwise it is "Stopped".
In the current TR search page for example we query the TestRun.filter API with a
stop_date__isnull=True parameter.

How to integrate the Reporter.log("Login failed.") with custom testng report using the IReporter?

I have been trying to generate a custom testng report similar to the emailable-report.html which is generated by default in testng. In my test case, I have added reporter.log statement to check the flow of test execution, but these logs are not getting printed in the custom report.
Is there a way to integrate the log statement in the custom report ?
In order for the messages logged via Reporter.log() to show up in your test reports, you would basically need to retrieve them using Reporter.getOutput(result) (Here result is of type org.testng.ITestResult). Invoking this method you would get a list of strings which represents the output associated with that particular ITestResult object. You would need to dump these lines into your report.
For a sample, take a look at this section of the EmailableReporter2.java from TestNG.

How to generate testNG report with assert pass or fail information

Hi I have a testNG class with Assert.assertTrue(true, "PASS"); and Assert.assertFalse(false, "FAIL"); statements. After the execution I am not able to find these PASS and FAIL result in the HTML report generated. I googled and found these may not be displayed in the report generated. So my question is, if testNG report does not provide this feature, is there any other reporting with which I can find these data after execution of my test in my report?
To log the information from the script to the HTML report we must use the class org.testng.Reporter. Now to print the data to the report we must use Reporter.log("PASS/FAIL");.
if you use Assert.assertTrue(condition, message); then when the condition is fail means it does not returns true, then the message is printed. So if assertion is true or pass then message is not printed.
To customize the HTML reports in TestNG, you need to use TestNG Listeners. below link will help you
http://testng.org/doc/documentation-main.html#logging-reporters
Let me know, if it is what you looking for.
Thank You,
Murali
If you want to fail the same Test case then you need to add Assert.fail() in your test case. Then it will display as fail in your report.

Coded UI test fails to find component in WPF application

I'm trying to run a coded UI test on our application. I can record the actions OK, but when attempting to playback, I get
Microsoft.VisualStudio.TestTools.UITest.Extension.UITestControlNotFoundException:
The playback failed to find the control with the given search properties.
Additional Details:
TechnologyName: 'UIA'
FrameworkId: 'Wpf'
ControlType: 'MenuItem'
AutomationId: 'MenuItemConnectId'
When I run Snoop on the application, I see the AutomationId exists
The one odd thing about our application is a lot of the ID's are added with code behind
menuItem.SetValue(AutomationProperties.AutomationIdProperty, "MenuItemConnnectId");
menuItem.SetValue(AutomationProperties.NameProperty, "MenuItemConnect");
Any ideas why this may be failing?
Thanks.
I think there are two reasons:
1.Maybe the component can't find the property.You can see the details in the xxx.Designer.cs file.
In the method SearchProperies[].....
2.The road to search the component is broken.You can see the details in the UI control map.Maybe the the component's parent is wrong.In this situation,you can add the code to connect them.
Turns out I needed the title of the window to be set. Even though I had the Automated ID and name properties set, looks like the engine uses the window's title in order to find it on the desktop. A few more details are here:
MSDN question on Coded UI test fails to find Window (Component)

Are there any tools for recording web browser events for seleniumn2?

I am looking for something very simple. It can use the Selenium IDE recording tool, but it does not allow me to pick what kind of locators I get.
I want to use:
driver.findElement(By.className(str))
to locate things. All I need is something which watches which UI elements on a web page get clicked and writes out the class attributes of those tags.
If I use the Selenium IDE recording (and export to the right type of thing), I get:
#Test
public void testNav() throws Exception {
driver.get(baseUrl + "/");
driver.findElement(By.name("3.1.1.5.1.1")).clear();
driver.findElement(By.name("3.1.1.5.1.1")).sendKeys("dan");
driver.findElement(By.name("3.1.1.5.1.5")).click();
driver.findElement(By.linkText("Products")).click();
driver.findElement(By.linkText("Categories")).click();
driver.findElement(By.linkText("Create a Category")).click();
driver.findElement(By.linkText("Cancel")).click();
driver.findElement(By.linkText("Products")).click();
driver.findElement(By.cssSelector("a.DisplayAdminProductsLink")).click();
driver.findElement(By.linkText("Product1")).click();
There are problems with this. First, it is not give me any By.className() calls. Why? Those first 3 calls will not help me. The framework I am using puts arbitrary things into the name. How can I get it to see the class attribute?
There actually are unique words in the class attribute of all of the above tags. I design my apps so that this is so. Yet it will not use them.
Earlier I asked:
Why is it doing a "driver.findElement().click()"? This is fragile and does not
end up working.
What I need is:
elt = driver.waitFor(By.className("c")); elt.click();
This will work reproducibly.....
I am considering to be removed from the question, as the findElement() code does work. You need to set a general time-out on the driver. It is not very obvious that this can be done, but it can.
So, continuing on....
I can go to the "Options" and change the order of the "Locator Builders" in eclipse. I can put "css" at the top. Then I get:
driver.findElement(By.cssSelector("input[name=\"3.1.1.5.1.1\"]")).clear();
driver.findElement(By.cssSelector("input[name=\"3.1.1.5.1.1\"]")).sendKeys("dan");
driver.findElement(By.cssSelector("input[name=\"3.1.1.5.1.5\"]")).click();
The tags are like:
<input class="form-control LoginUsernameField" ... />
But it does not see the class attribute.... Or I can do this manually.
Selenium looks for a unique identifier to identify elements in a webpage. classNames are a very less desired option for this purpose as they are generally not unique. Ids and names on the other hand are generally unique. This might be the reason why Selenium IDE is not selecting classNames and going for other identifiers.
Selenium IDE records user actions. You would have clicked on the element for Selenium IDE to identify it and that is why you are getting driver.findElement().click().
If you want to wait for element to wait you can try implicit wait.
When you want to use driver.findElement(By.className(str)), are you sure that there is one and only one element in the webpage that is associated with a className? If that is the case you can modify the webdriver code manually to use className.

Resources