Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

How to get files referenced by cs included by ncrunch?
Stant
#1 Posted : Thursday, June 16, 2016 5:06:50 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 6/16/2016(UTC)
Posts: 1
Location: United States of America

We are hitting the classic issue: Files needed in the test env are not included in the build output. Full error below.

But we do not know how to approach this!

Flow:
cs code reference files on disk (excel xls files). These files are imported into a sqllite file, and then the cs code runs against sqllite

When we run in vs under nunit or testdriven.net, the tests run and pass.

But in ncrunch, we get the error below.

ncrunch is right (because the files are not in the project reference). But they need to both be included AND in the right location for it all to work.

Questions:
Sooooo, we need to understand how to add references to the xls files so that:

a) Code will still run and test and find the xls files when run locally (files will be off in some path from version control, not in dir next to cs)

b) xls is included so ncrunch can see them

c) What compiler directives do we use so that when ncrunch compiles, the cs will look in different location?

d) How can we see/understand the ncrunch run time env? We need to know so we can make appro adjustments in code (prob under compiler directives that only fire when running under ncrunch)

Thanks!

Quote:

System.ApplicationException : Unable to import data from '..\..\..\sourcedata\2016\BaseData48States.xls', sheet: main-excel_Z . Directory "..\..\..\sourcedata\2016" does not exixt.
at testapplication.Rating.LoaderBaseRatesFromExcelData.LoadRateCharts(CensusBaseRateDatabase baseRateDatabase, String ratesFilename, String xlsSheet, TCensusService service, List`1 zoneNames) in C:\Develop\testapplication\Current\WebApplications\testapplicationWeb\testapplication.Rating\testapplication.Rating.Core\Census\DataLoader\LoaderBaseRatesFromExcelData.cs:line 230
at testapplication.Rating.LoaderBaseRatesFromExcelData.Loadmain-excel_Z(CensusBaseRateDatabase baseRateDatabase, String path) in C:\Develop\testapplication\Current\WebApplications\testapplicationWeb\testapplication.Rating\testapplication.Rating.Core\Census\DataLoader\LoaderBaseRatesFromExcelData.cs:line 46
at testapplication.Rating.LoaderBaseDataAbstract.LoadRatesAll(String path, String ratesDatabaseFileName) in C:\Develop\testapplication\Current\WebApplications\testapplicationWeb\testapplication.Rating\testapplication.Rating.Core\Census\DataLoader\LoaderBaseDataAbstract.cs:line 99
at testapplication.Rating.A_RunFirst.LoadingCensusDataTests_2016.A_LoadBaseRates() in C:\Develop\testapplication\Current\WebApplications\testapplicationWeb\testapplication.Rating\testapplication.Rating.Tests.RunOnBuildBox\Census\LoadingCensusDataTests_2016.cs:line 98
Remco
#2 Posted : Thursday, June 16, 2016 10:58:13 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,145

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi,

If I understand this problem correctly, it should be possible for us to fix this fairly easily.

NCrunch builds shadow copies of your projects when it builds them, called 'workspaces'. These workspaces can be viewed by right-clicking a project in the Tests Window and choosing Advanced->Browse To Workspace.

For NCrunch to copy files into the workspace, it needs to be aware that these files are required for the project. Most files are auto-detected, but some need to be specified using configuration. See implicit file dependencies for more details.

There are ways to introduce conditional behaviour in your code dependent on NCrunch, but I don't think this is necessary to solve your problem and should ideally be avoided where possible.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.033 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download