# How do I constrain data within hierarchy at test level?

**URL:** <https://verificationacademy.com/forums/t/how-do-i-constrain-data-within-hierarchy-at-test-level/38937>\
**Category:** UVM\
**Tags:** UVM, constraints\
**Created:** [April 4, 2021, 3:29am UTC](https://verificationacademy.com/forums/t/how-do-i-constrain-data-within-hierarchy-at-test-level/38937 "2021-04-04T03:29:22Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![tfitz](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/tfitz/32/3025_2.png) [@tfitz](https://verificationacademy.com/forums/u/tfitz)\
**Post date:** [April 6, 2021, 12:41pm UTC](https://verificationacademy.com/forums/t/how-do-i-constrain-data-within-hierarchy-at-test-level/38937/7 "2021-04-06T12:41:24Z")

</div>

_In reply to [Dragewood](https://verificationacademy.com/forums/t/how-do-i-constrain-data-within-hierarchy-at-test-level/38937/6):_

> _In reply to [tfitz](https://verificationacademy.com/forums/t/how-do-i-constrain-data-within-hierarchy-at-test-level/38937/6):_  
> One drawback of this approach is, in the future if I add several tests, and then need to add/modify a constraint in the base sequence, I’ll need to make that same change in every extended sequence.

That’s a pretty big drawback and is the main reason I recommended against using randomize-with. Since you have to manage test/sequence pairs anyway, you could just as easily manage test/item pairs, where the test uses the factory to choose the properly-constrained sequence item type. Then, if you have to modify a constraint in the base item type, it will automatically get picked up by all the others and you don’t have to make the same edit in a whole bunch of sequences. That’s kind of the whole point of object-oriented programming, by the way.

Good luck,  
-Tom

---

_[View the full topic](https://verificationacademy.com/forums/t/how-do-i-constrain-data-within-hierarchy-at-test-level/38937)._
