Giter Site home page Giter Site logo

Comments (7)

cwrea avatar cwrea commented on August 16, 2024 1

I am experiencing this issue as well with xunit.runner.devices.2.3.3. Tests are not being discovered in my Android unit test app build.

However, I notice the problem only occurs when my Android project's Android Options tab has the option "Use Fast Deployment (debug mode only)" unchecked. If the option is checked (which also requires the "Use Shared Runtime" option to be checked), then tests are discovered.

But I'd like to be able to run tests in a release build and without relying on the shared runtime.

from devices.xunit.

cwrea avatar cwrea commented on August 16, 2024 1

I can confirm that downgrading xunit.runner.devices to v2.2.0 gets test discovery working again, and without requiring "Use Fast Deployment (debug mode only)" nor "Use Shared Runtime". With v2.2.0 I am able to deploy a release build to a device, which has neither of those options checked, and tests are bring discovered.

Might be due to recent changes made to DiscoverTestsInAssemblies() in src/xunit.runner.devices/DeviceRunner.cs, e.g. here.

from devices.xunit.

borrrden avatar borrrden commented on August 16, 2024

Just in case you are curious about the projects: iOS and Android

from devices.xunit.

clairernovotny avatar clairernovotny commented on August 16, 2024

I'm looking into this, but I think there's something with the Linker and/or optimizer.

I was able to repro, but debugging is hard since the debugger won't attach in the scenario. I got it to work by setting the Android Options linker mode to None and turning off "Optimize code" on the Build tab.

In that, it works without the shared runtime. I'll keep digging, but this hopefully can unblock you.

from devices.xunit.

pasn avatar pasn commented on August 16, 2024

It seems that you are right @onovotny . I was playing with custom linker configuration and the minimal configuration that I found working was:

  <assembly fullname="xunit.core">
    <type fullname="Xunit.FactAttribute" />
    <type fullname="Xunit.InlineData" />
    <namespace fullname="Xunit.Sdk" />
  </assembly>
  <assembly fullname="xunit.execution.dotnet" />
  <assembly fullname="xunit.runner.devices">
    <type fullname="Xunit.Runners.AutomationTextCellRenderer" />
    <type fullname="Xunit.Runners.TestAssemblyViewModel" />
    <type fullname="Xunit.Runners.TestCaseViewModel" />
    <type fullname="Xunit.Runners.TestResultViewModel" />
    <type fullname="Xunit.Runners.HomeViewModel" />
  </assembly>

Could you add [Preserve(AllMembers=True)] attribute to all or at least some of these classes?

from devices.xunit.

clairernovotny avatar clairernovotny commented on August 16, 2024

I can't add those to the main xUnit libs, but it looks like that config file can be added to the devices with the LinkDescription build action:
https://docs.microsoft.com/en-us/xamarin/cross-platform/deploy-test/linker

from devices.xunit.

pasn avatar pasn commented on August 16, 2024

That's right. If you are doing something like this, I would recommend to include full assemblies without specifying types and namespaces. Linker's configuration that I presented above seems to be fragile for future changes. I would rather recommend something like this:

<linker>
  <assembly fullname="xunit.core" />
  <assembly fullname="xunit.execution.dotnet" />
  <assembly fullname="xunit.runner.devices" />
</linker>

BTW: If you have another linker script in consuming project, is it safe to add another target with LinkDescription build action?

from devices.xunit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.