# Unit Testing workflow form button

**URL:** https://discuss.tryton.org/t/unit-testing-workflow-form-button/3146
**Category:** Developer
**Created:** [August 24, 2020, 2:00pm UTC](https://discuss.tryton.org/t/unit-testing-workflow-form-button/3146 "2020-08-24T14:00:05Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Arlequin](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/a/aeb1de/32.png) [@Arlequin](https://discuss.tryton.org/u/Arlequin)
#### Post date: [August 24, 2020, 2:00pm UTC](https://discuss.tryton.org/t/unit-testing-workflow-form-button/3146/1 "2020-08-24T14:00:05Z")

</div>

I created a workflow with buttons whitch run good but when I use ‘Proteus’ for my unit tests, it fail because as it says in terminal : i have to register the buttons

in the contract.xml file of my model :

```xml
<record model="ir.action.act_window.domain" id="act_my_contract_domain_cancel">
   <field name="name">Canceled</field>
   <field name="sequence" eval="20"/>
   <field name="domain" eval="[('state', '=', 'cancel')]" pyson="1"/>
   <field name="count" eval="True"/>
   <field name="act_window" ref="act_my_package_form"/>
</record>

<record model="ir.action.act_window.domain" id="act_my_contract_domain_draft">
    <field name="name">Draft</field>
    <field name="sequence" eval="20"/>
    <field name="domain" eval="[('state', '=', 'draft')]" pyson="1"/>
    <field name="count" eval="True"/>
    <field name="act_window" ref="act_my_package_form"/>
</record>

<record model="ir.action.act_window.domain" id="act_my_contract_domain_printed">
    <field name="name">Printed</field>
    <field name="sequence" eval="30"/>
    <field name="domain" eval="[('state', '=', 'printed')]" pyson="1"/>
    <field name="count" eval="True"/>
    <field name="act_window" ref="act_my_package_form"/>
</record>

<record model="ir.action.act_window.domain" id="act_my_contract_domain_signed">
    <field name="name">Signed</field>
    <field name="sequence" eval="40"/>
    <field name="domain" eval="[('state', '=', 'signed')]" pyson="1"/>
    <field name="count" eval="True"/>
    <field name="act_window" ref="act_my_package_form"/>
</record> 

```

How can i register my buttons for my units tests ?

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [August 24, 2020, 2:20pm UTC](https://discuss.tryton.org/t/unit-testing-workflow-form-button/3146/2 "2020-08-24T14:20:34Z")

</div>

You should create a record for each button on `ir.model.button`. The name of the record much match your button definition. You can also the optional attributes like the string, the help or the confirm text of the button. This attributes will be used when this attributes are not set on the view.

You have a [complete example on the account\_invoice](https://hg.tryton.org/modules/account_invoice/file/a328fca34a4b/invoice.xml#l151) module.

Hope it helps!
