0

I have a solution, it has 4 projects, each project has a corresponding test project in a "tests" solution

I've noticed that sometimes a test fails locally but passes the CI build, and depending where the test is located, sometimes it does successfully fail on CI build.

Our ADO pipeline steps looks like: pipe steps

Here is a csproj from a test project that is running successfully:

successful csproj

Here is a csproj from a test project that isnt running:

csproj that isnt running its tests

Any ideas? I have narrowed down some test classes that I know are running, but I cant tell what is different about those class' csproj versus the ones that are not running.

Matt
  • 3,658
  • 3
  • 14
  • 27
heug
  • 982
  • 2
  • 11
  • 23
  • I’m wondering why you think there’s something different about the **project** that makes the test pass or fail in different environments? I’d suspect it was something to with the test itself. Can you show an example of one of the tests? – stuartd Mar 03 '22 at 21:19
  • @stuartd theres hundreds of tests and they all run fine (fail and pass when expected) locally ... its definitely something config related, ive been able to write an `Assert.True(false)` test and see it fail on the CI build in the successful project, but when i put that in the broken project, it doesnt fail on the CI – heug Mar 03 '22 at 21:21
  • that does sound very weird.. but I’m not sure there’s enough info here to be able to tell what’s wrong. Can I ask what the `Compile Remove` project entry is for? – stuartd Mar 03 '22 at 21:24
  • not sure, some random stuff from the days before i worked on this... the files theyre referencing dont even exist anymore. Gonna try removing those and seeing if it has an impact. – heug Mar 03 '22 at 21:30
  • @stuartd another thing to note is that the files that ARE running properly arent being referenced anywhere in csproj files, i dont think their parent paths are either – heug Mar 03 '22 at 21:33
  • 1
    @stuartd check out my reply below if you will, found out the issue, just not sure how to solve – heug Mar 04 '22 at 21:40

1 Answers1

0

Turns out the test project that was not running was created outside of other projects: my project

when i manually move it in finder, and try to replace the reference paths in the csproj to reflect how the paths in the functioning test projects are laid out, the project refuses to load.

anyone know how to easily and safely refactor/move this project??

the best solution here is to create a new project, name it similarly (or name it whatever) then delete the old one once its running properly, and finally rename the new one to the old name

heug
  • 982
  • 2
  • 11
  • 23
  • How come you can’t you just move it and fix the path in the solution and referencing project files? Sometimes things work locally because the other projects have been built, but on a clean build - like when running tests - they aren’t there.. – stuartd Mar 04 '22 at 22:51
  • 1
    to be honest, i dont know, i tried that but Rider wasnt playing ball ... even when i deleted the old one, made a new one, and renamed it, it didnt let me rename it to the old thing .. somehow there was a stray reference to it. frustrating. we settled with just having a slightly different named project (infra instead of infrastructure) – heug Mar 16 '22 at 20:43