Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I stop my Xamarin.UITest from running Tests twice?

I am writing some UITests using the Xamarin.UITest library. but every test I run always runs twice regardless of whether it has passed or failed?

My app configuration looks like this:

app = ConfigureApp.Android.ApkFile(PathToAPK).WaitTimes(new WaitTimes()).EnableLocalScreenshots().StartApp(Xamarin.UITest.Configuration.AppDataMode.DoNotClear);

and all my test classes are marked with the following attributes:

[TestFixture(Platform.Android)]
[TestFixture(Platform.iOS)]

I run the test on Android and it will run twice on Android regardless of whether it has passed or failed.

How do I stop this? / What is causing this?

like image 998
User1 Avatar asked Jan 07 '23 01:01

User1


1 Answers

Ok so I found the problem here.

all my TestClasses inherited from my own UITestBase. I had declarated UITestBase with the TestFixture attributes. and I had also declarated my TestClasses with the same attribute. which resulted in this:

Test Class

[TestFixture(Platform.Android)]
[TestFixture(Platform.iOS)]
class TestClass : UITestBase
{

}

Base class

[TestFixture(Platform.Android)]
[TestFixture(Platform.iOS)]
class UITestBase
{
}

Therefore ended up with my tests all running twice

like image 180
User1 Avatar answered Jan 08 '23 14:01

User1