run tests from scene to another and run in the same order

3 views
Skip to first unread message

altobeh unity

unread,
Jul 16, 2020, 8:24:18 AM7/16/20
to AltUnity - UI test automation tool for Unity3D
in our project, we have some cases when the player should play 100 different level
and in each one, we load a new scene for some animation and then we take the player to levels scene
How can I ensure my test will continue after the scene is loaded?
and how can I make my whole tests replay in the same order more than once?
another thing sometimes the player should go from scene to another
then in the new scene, we want to run some tests
Then the player will go back to the scene that he came from
and test should continue from the last point that they were stopped for example the player played 30 levels and in 31 the scene load thing happened
then I want the test to continue from 31 not from scratchexImg.JPG

Dorin Oltean

unread,
Jul 17, 2020, 5:32:34 AM7/17/20
to altobeh unity, AltUnity - UI test automation tool for Unity3D
Hey,

If you have a single flow to test, the method to tag your tests with order should instruct nunit to respect the order provided. This means that when writing your tests you need to pay attention that test 5 will continue after test 4. So the state of the game at the end of 4 should be what you expect in scene 5. 
In your scenario you have a loop in your tests. Meaning you execute test 1,2, 3, 4, 5,  then  you want to go back to 3 then 6.. This is not possible with a linear execution model. 

A solution for this would be to duplicate your tests  so that tests that need to execute twice have two methods with different order attributes.

Another solution would be to combine Category with Order and  so Category A executes flow 1,2,3,4,5, and Category B executes flow 1,2,3,6.. And you run your tests from command line and first run Category A and then Category B. This might not be enough for you if you want to make sure the entire flow works smoothly for a single game instance.

Another solution would be to use State Transition Testing, which means you design your tests as a directed graph, and instruct the test execution framework that from state 3 you can transition to state 4 or to state 6.  This solution should cover all tests in a single game instance without duplicating the code.

--
You received this message because you are subscribed to the Google Groups "AltUnity - UI test automation tool for Unity3D" group.
To unsubscribe from this group and stop receiving emails from it, send an email to altunityforu...@altom.com.
To view this discussion on the web visit https://groups.google.com/a/altom.com/d/msgid/altunityforum/ea36b5fa-1da0-44a0-b9ef-f4d48ae331acn%40altom.com.


--

Dorin Oltean

AltUnity Developer @ Altom
AltWalker Developer @ Altom
Python & Vue.js Developer

Message has been deleted

altobeh unity

unread,
Jul 20, 2020, 5:26:09 AM7/20/20
to AltUnity - UI test automation tool for Unity3D, altobe...@gmail.com
Hi Dorin 
thanks for your answers
the best suitable solution in our case is the 2nd one which is run different Categories through the command line
but if could you provide us an example or a documntation about it that  would be so much helpful,
thanks

On Friday, July 17, 2020 at 12:32:34 PM UTC+3, Dorin Oltean wrote:
Hey,

If you have a single flow to test, the method to tag your tests with order should instruct nunit to respect the order provided. This means that when writing your tests you need to pay attention that test 5 will continue after test 4. So the state of the game at the end of 4 should be what you expect in scene 5. 
In your scenario you have a loop in your tests. Meaning you execute test 1,2, 3, 4, 5,  then  you want to go back to 3 then 6.. This is not possible with a linear execution model. 

A solution for this would be to duplicate your tests  so that tests that need to execute twice have two methods with different order attributes.

Another solution would be to combine Category with Order and  so Category A executes flow 1,2,3,4,5, and Category B executes flow 1,2,3,6.. And you run your tests from command line and first run Category A and then Category B. This might not be enough for you if you want to make sure the entire flow works smoothly for a single game instance.

Another solution would be to use State Transition Testing, which means you design your tests as a directed graph, and instruct the test execution framework that from state 3 you can transition to state 4 or to state 6.  This solution should cover all tests in a single game instance without duplicating the code.

On Thu, Jul 16, 2020 at 3:24 PM altobeh unity <altobe...@gmail.com> wrote:
in our project, we have some cases when the player should play 100 different level
and in each one, we load a new scene for some animation and then we take the player to levels scene
How can I ensure my test will continue after the scene is loaded?
and how can I make my whole tests replay in the same order more than once?
another thing sometimes the player should go from scene to another
then in the new scene, we want to run some tests
Then the player will go back to the scene that he came from
and test should continue from the last point that they were stopped for example the player played 30 levels and in 31 the scene load thing happened
then I want the test to continue from 31 not from scratchexImg.JPG

--
You received this message because you are subscribed to the Google Groups "AltUnity - UI test automation tool for Unity3D" group.
To unsubscribe from this group and stop receiving emails from it, send an email to altuni...@altom.com.

Dorin Oltean

unread,
Jul 21, 2020, 2:48:48 AM7/21/20
to altobeh unity, AltUnity - UI test automation tool for Unity3D
You can tag your tests with category ( you can tag one test with multiple categories ) . Docs here https://docs.nunit.org/articles/nunit/writing-tests/attributes/category.html?q=category

Then run your tests with filter
dotnet test --filter TestCategory=Foo


[Test, Order(1)]
[Category("Flow1")]
public void TestA() { /* ... */ }


[Test, Order(2)]
[Category("Flow1")]
[Category("Flow2")]
public void TestB() { /* ... */ }

[Test, Order(3)]
[Category("Flow2")]
public void TestC() { /* ... */ }
  
  dotnet test --filter TestCategory=Flow1  # this will Run TestA, TestB 
 dotnet test --filter TestCategory=Flow2  # this will Run TestB, TestC



To unsubscribe from this group and stop receiving emails from it, send an email to altunityforu...@altom.com.
To view this discussion on the web visit https://groups.google.com/a/altom.com/d/msgid/altunityforum/e58b06b1-4f17-490c-9b79-aa8cc025a10co%40altom.com.
Reply all
Reply to author
Forward
0 new messages