Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not works... #1

Open
raveneer opened this issue Nov 7, 2017 · 11 comments
Open

not works... #1

raveneer opened this issue Nov 7, 2017 · 11 comments

Comments

@raveneer
Copy link

raveneer commented Nov 7, 2017

hello. i'm very excited your work.
but sadly not works for me...

  1. open unity 2017.1.2f1 / NCrunch 3.11.0.9 / VS2017

  2. add edit mode test. test runner > pass

  3. install adapter from asset store

  4. close unity

  5. open unity. open testcode with vs (by unity editor)

  6. NCrunch throw casting error.

  7. solutions reference not changed. (still C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/TestRunner/net35/unity-custom/nunit.framework.dll)

  8. i add small debug line

ProjectFilesGenerator.ProjectFileGeneration += (string name, string content) =>
{
Debug.Log("change done!");
return content.Replace(NUnitUnityReference, NUnitOfficialReference);
};
9. close unity. open unity.
10. i can see "change done!" twice.
11. open testcode.
12. still same. not works (like .6)


NCrunch error line

An error occurred while analysing this project after it was built: System.Reflection.TargetInvocationException: 호출 대상이 예외를 Throw했습니다. ---> System.InvalidCastException: 'nCrunch.Module.NUnit3.Integration.NUnit3CallbackProxy' 형식 개체를 'System.Web.UI.ICallbackEventHandler' 형식으로 캐스팅할 수 없습니다.
위치: NUnit.Framework.Api.FrameworkController.LoadTestsAction..ctor(FrameworkController controller, Object handler)
--- 내부 예외 스택 추적의 끝 ---
위치: System.RuntimeMethodHandle._InvokeConstructor(Object[] args, SignatureStruct& signature, IntPtr declaringType)
위치: System.RuntimeMethodHandle.InvokeConstructor(Object[] args, SignatureStruct signature, RuntimeTypeHandle declaringType)
위치: System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
위치: System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
위치: System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
위치: nCrunch.Module.NUnit3.Integration.FrameworkController.LoadTests(INUnit3CallbackHandler handler)
위치: nCrunch.Module.NUnit3.Integration.NUnit3FrameworkInteractor.b__7_0()
위치: nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
위치: nCrunch.Common.PerformanceTracking.PerfTracker.TryTrackActivity(String name, Action activity)
위치: nCrunch.Module.NUnit3.Integration.NUnit3FrameworkInteractor.prepareFramework(DynamicProxy[] dynamicProxies)
위치: nCrunch.Module.NUnit3.Integration.NUnit3FrameworkInteractor..ctor(ReflectedAssembly assembly, IList1 referencedAssemblyFilePaths, ComponentUniqueName testComponentUniqueName, DynamicProxy[] dynamicProxies) 위치: nCrunch.Module.NUnit3.Integration.NUnit3FrameworkRuntimeEnvironment.FindFrameworkTestsInAssembly(ReflectedAssembly assembly, FilePath assemblyFilePath, IList1 referencedAssemblyFilePaths, ComponentUniqueName testComponentUniqueName, PlatformType platformType, DynamicProxy[] dynamicProxies)
위치: nCrunch.TestExecution.TestFinder.�.�()
위치: nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
위치: nCrunch.TestExecution.TestFinder.�.�()
위치: nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
위치: nCrunch.TestExecution.TestFinder.FindTestsForFrameworks(ReflectedAssembly assembly, FilePath assemblyFilePath, IList`1 referencedAssemblyFilePaths, DescribedTestFrameworkDiscoverer[] describedDiscoverers, ComponentUniqueName testComponentUniqueName, PlatformType platformType, DynamicProxy[] dynamicProxies)
위치: nCrunch.TestExecution.RemoteTaskRunner.AnalyseAssembly(DescribedTestFrameworkDiscoverer[] applicableFrameworks, ComponentUniqueName testComponentUniqueName, PerfTracker perfTracker)


plus : when i change Nunit dll from
Files\Unity\Editor\Data\UnityExtensions\Unity\TestRunner\net35\unity-custom\nunit.framework.dll
to your asset's Nunit dll,
'NCrunch works fine, but Unity TestRunner fail'
in this case, can't test monobehaviors. not helpful :(

@raveneer
Copy link
Author

raveneer commented Nov 7, 2017

I rewrite file locations, now works fine. (Ncrunch with testrunner)

using SyntaxTree.VisualStudio.Unity.Bridge;
using UnityEditor;

[InitializeOnLoad]
public class NCrunchAdapterForUnity
{
public const string NUnitUnityReference = @"<Reference Include=""nunit.framework"">
C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/TestRunner/net35/unity-custom/nunit.framework.dll
";

public const string NUnitOfficialReference = @"<Reference Include=""nunit.framework"">
  <HintPath>Assets/Plugins/Editor/NCrunchAdapterForUnity-master/NUnit.3.5.0/lib/net35/nunit.framework.dll</HintPath>
</Reference>";

static NCrunchAdapterForUnity()
{
    ProjectFilesGenerator.ProjectFileGeneration += (string name, string content) =>
    {
        return content.Replace(NUnitUnityReference, NUnitOfficialReference);
    };
}

}

directory may different with user...

@raveneer
Copy link
Author

raveneer commented Nov 7, 2017

hm.... when i add playmode test, ncrunch build fail.
can test editmode only....

@networm
Copy link
Owner

networm commented Nov 11, 2017

Yes, this adapter only support editor mode test. Because editor mode test is unit test, play mode test is integration test.

@networm
Copy link
Owner

networm commented Nov 11, 2017

The newest version v1.2.0 has fixed this problem. It has changed to using regex to replace string for path inconsistence between Unity versions.

@networm
Copy link
Owner

networm commented Nov 11, 2017

'NCrunch works fine, but Unity TestRunner fail'

This should not happen because Unity didn't use project files to run tests and NCrunch use project files only to run tests.
So I think you should check other problems.

@raveneer
Copy link
Author

still not work. nunit refrence not changing. sometimes change, sometimes not. can't find reason. i tried absolute folder location, still not changing. on/off unity, remove solution/remade, not works too.

@networm
Copy link
Owner

networm commented Nov 12, 2017

Could you make a minimized project which could reproduce this problem and send to me?

@networm
Copy link
Owner

networm commented Nov 12, 2017

The core code is very simple, I think you could debug it yourself.
Just Debug.Log(content) before and after replace operation. Check what has happened.

@networm
Copy link
Owner

networm commented Nov 28, 2017

@raveneer Have you solved this problem?

@raveneer
Copy link
Author

yes now works. but when I make a new project, sometimes swap not happens. then I compile several times until fix. (but it's random)

@networm
Copy link
Owner

networm commented Nov 29, 2017

Could you output content every time when swap not happens, and check what caused the problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants