Solved

Change object of unit test

  • 21 June 2021
  • 3 replies
  • 44 views

Userlevel 5
Badge +15

I have applied some changes in a data structure, where the original table is no longer exposed to end users, but instead is exposed via views. The already created unit tests are still on the object that is no longer exposed. How can I change the unit test “Object” (dbo.unit_test.object) value to the new view? Because it's read only as far I can see. Is it safe to update that field value, or must I rewrite all unit tests?

 

icon

Best answer by Mark Jongeling 21 June 2021, 10:48

View original

3 replies

Userlevel 7
Badge +23

Hi René,

I'm trying to recreate the issue you have but I can't seem to replicate it. How did you get this result?

What I tried was add an Unit test to a table, then in Data model change it to a View, and then check Unit test again, but for me nothing indicates anything is wrong. (SF 2021.2)

The object is a coalesce of multiple fields:

[Object] field

Tab_id is both for tables and views and also share the same assignable Unit test types:

Unit test types

Hope this gives a bit of insight. Reproduction steps are needed for me to give a bit more of a conclusive answer.

Userlevel 5
Badge +15

Hi,

What I've done is the following:

I've created a table (purchase_order). I've attached a unit test for it, for example for the default concept. Then I've added a new view (ui_purchase_order). This view is the replacement of the table, so I want to move the existing default logic to the new ui_ view. However, what I didn't mention I also created a new default (control procedure) for the ui_purchase_order, and moved the templates from purchase_order into the new control procedure. I removed the old ones.

Doing this results in this:

And also indicates this using a red font:

I want to move the unit test to the new (proper) object. The unit test didn't move along in this case, I think it should be fixed when the Object in the image above is also ui_purchase_order instead of purchase_order. But I can't do this via the SF. And rewriting is also a bit time consuming ;-).

Userlevel 7
Badge +23

You can update the tab_id column in the unit_test table to change the Unit test assignment. Updating it to ui_purchase_order will cause the unit test to be assigned to that view. Do note that the use defaults column in Subjects > Settings should be true so the assignment is visible, otherwise it looks like this:

Incorrect assignment to object

Do you think we should facilitate such object assignment transition or is this a specific case that does not happen often? Feel free to create an idea for this if desired :wink:

Reply