Allure Framework: TestNG adapter incorrectly places #AfterMethod in report - allure

I`m using allure V1.4.8 +TestNG. It looks like TestNG adapter incorrectly places #AfterMethod in report - basically it places AfterMethod from test case into next testcase.
Here is the simple code:
#Step("a test1")
#Test
public void Test1(){
}
#Step("a test2")
#Test
public void Test2(){
}
#Step("before method")
#BeforeMethod
public void beforeMethod(){
}
#Step("after method")
#AfterMethod
public void methodCleanup()
{
}
And here is the generated report:
<test-cases>
<test-case start="1424347388060" stop="1424347388730" status="passed">
<name>Test1</name>
<steps>
<step start="1424347388011" stop="1424347388014" status="passed">
<name>before</name>
<title>before test</title>
<attachments/>
<steps/>
</step>
<step start="1424347388036" stop="1424347388036" status="passed">
<name>beforeMethod</name>
<title>before method</title>
<attachments/>
<steps/>
</step>
<step start="1424347388067" stop="1424347388067" status="passed">
<name>Test1</name>
<title>a test1</title>
<attachments/>
<steps/>
</step>
</steps>
<labels>
<label name="host" value=""/>
<label name="thread" value=""/>
</labels>
</test-case>
<test-case start="1424347388747" stop="1424347389056" status="passed">
<name>Test2</name>
<steps>
<step start="1424347388739" stop="1424347388739" status="passed">
<name>methodCleanup</name>
<title>after method</title>
<attachments/>
<steps/>
</step>
<step start="1424347388746" stop="1424347388746" status="passed">
<name>beforeMethod</name>
<title>before method</title>
<attachments/>
<steps/>
</step>
<step start="1424347388750" stop="1424347388750" status="passed">
<name>Test2</name>
<title>a test2</title>
<attachments/>
<steps/>
</step>
</steps>
</test-case>
</test-cases>

It's problem of TestNG adaptor. In our adaptor we use ITestListener listener and onTestSuccess, onTestFailure, onTestFailedButWithinSuccessPercentage and onTestSkipped methods to mark test as finished. But TestNG call the methods before #AfterMethod.
I don't know is there a way to handle befores and afters (maybe we can use other listener, an example IInvokedMethodListener). You can investigate this problem and send us pull request.
Hope it helps
Update
New Allure TestNG integration has support for test fixtures. So you need to upgrade to Allure 2. For more details see the docs https://docs.qameta.io/allure/2.0/#_testng

Related

ReferenceManyInput in react-admin

In react-admin we have ReferenceManyField. It would be fantastic to have also a component called ReferenceManyInput, with a functionallity very similar to the ArrayInput component (add, remove buttons) but with reference to a resource.
¿Does any one know if they have intention to include it or is there any workaround to achieve this?
The use case is:
I have a form for creating/editing an entity where one of its properties is an array of other related entities. I would like to add and/or remove new elements to that array and when submitting the main entity, it creates/updates/remove the related entity and the main entity.
Maybe I am asking for too much...
Thanks in advance
You're in luck: <ReferenceManyInput> was just published as part of React-admin Enterprise Edition. It works just like ReferenceManyField:
import {
Edit,
SimpleForm,
TextInput,
NumberInput,
ReferenceInput,
SelectInput,
} from 'react-admin';
import { ReferenceManyInput } from '#react-admin/ra-relationships';
const ProductEdit = () => (
<Edit mutationMode="optimistic">
<SimpleForm>
<TextInput source="name" />
<NumberInput source="price" />
<ReferenceInput source="category_id" reference="categories" />
<ReferenceManyInput reference="variants" target="product_id">
<SimpleFormIterator inline>
<TextInput source="sku" />
<SelectInput source="size" choices={sizes} />
<SelectInput source="color" choices={colors} />
<NumberInput source="stock" defaultValue={0} />
</SimpleFormIterator>
</ReferenceManyInput>
</SimpleForm>
</Edit>
);
The result looks like:
Check https://marmelab.com/ra-enterprise/modules/ra-relationships#referencemanyinput for details.

Change behavior of Steps React component from Ant Design(https://ant.design/components/steps/)

As in the link example, I would like to change the behavior of Steps react component from ANT design to just color and select(highight) only on the step that is click(as oppose to now it colors all the previous steps also)
You have to make use of the status prop in Step.
Documentation
Example in CodeSandbox
Intead of:
<Steps current="2">
<Step title="INSTRUCTIONS" />
<Step title="REGISTRATION" />
<Step title="VERIFICATION" />
</Steps>
use status wait on previous steps:
<Steps current="2">
<Step status="wait" title="INSTRUCTIONS" />
<Step title="REGISTRATION" />
<Step title="VERIFICATION" />
</Steps>
There is a prop available for status in Step component. It overrides highlight by current variable. You can use that.
E.g:
<Steps current={this.state.current} progressDot={customDot}>
<Step
title="Finished"
status={0 < this.state.current ? "wait" : null}
description="You can hover on the dot."
/>
<Step
title="In Progress"
status={1 < this.state.current ? "wait" : null}
description="You can hover on the dot."
/>
<Step
title="Waiting"
status={2 < this.state.current ? "wait" : null}
description="You can hover on the dot."
/>
<Step
title="Start"
status={3 < this.state.current ? "wait" : null}
description="You can hover on the dot."
/>
</Steps>,
);

Error loading model: Missing chain 'vespa'

I have my custom Searcher and my custom DocumenetProcessor in my vespa app.My service.xml is given below:
<services version="1.0">
<container id="default" version="1.0">
<document-api/>
<search>
<chain id="default" inherits="vespa">
<searcher id="com.example.test.CustomSearcher" bundle="example-vespa-app"/>
</chain>
</search>
<nodes>
<node hostalias="node1" />
</nodes>
<document-processing>
<chain id="default" inherits="vespa">
<documentprocessor id="com.example.test.CustomDocumentProcessor"/>
</chain>
</document-processing>
</container>
<content id="test_user" version="1.0">
<redundancy>1</redundancy>
<documents>
.....
</documents>
<nodes>
<node hostalias="node1" distribution-key="0" />
</nodes>
</content>
</services>
My CustomDocumentProcessor is given below:
public class CustomDocumentProcessor extends DocumentProcessor {
#Override
public Progress process(Processing processing) {
for (DocumentOperation op : processing.getDocumentOperations()) {
if (op instanceof DocumentPut) {
DocumentPut put = (DocumentPut) op;
Document document = put.getDocument();
document.setFieldValue("documentType",
String.valueOf(document.getDataType()));
}
}
return Progress.DONE;
}
}
When I remove CustomDocumentProcessor from service.xml, my app works .When I add it , It gives an error:
Request failed. HTTP status code: 400
Invalid application package: default.default: Error loading model: Missing chain 'vespa'.
Why is that? Please help.
Remove "inherits=vespa" from the document-processing chain.
There is no "vespa document processing chain like there is for search chains.

How to pass enctype to simpleform in admin-on-rest?

I am using admin-on-rest. I want to build file upload functionality using simpleform component of admin-on-rest framework.
For this, I want to pass enctype="multipart/form-data" to form.
I am not able find any documentation or forums to understand, how can I pass this, if inside any props, or some other way.
Please help with this.
Below is my code snippet:
<Create {...props}>
<SimpleForm enctype="multipart/form-data">
<FileInput source="files" label="Related files" multiple accept="text/*,image/*">
<FileField source="src" title="title" />
</FileInput>
</SimpleForm>
</Create>

I'm trying to implement factorial in an xml language

I'm trying to implement factorial in the xml language of xcerion.
<step id="fac">
<alias name="p" value="={$n}*{$p}" />
<alias name="n" value="={$n}-1" />
<operation name="decision">
<when test="'{$n}'>'0'" step="fac" />
</operation>
</step>
<alias name="p" value="1" />
<alias name="n" value="4" />
<operation name="call" value="fac" />
My code works, but I think it's a bit wordy.
How does this language compare with other xml languages?
Especially handling of variables, selection, loops and subroutine calling.

Resources