I've seen this to many times where I can observe that all the files necessary to create the dll file remotely are not being copied to the remote box. Thus giving errors?
Please explain in this thread if all the files need to run the file locally are compiled locally or remotely? If they are compiled remotely, then why is the software not copying all the files necessary over to the remote machine.
This is frustrating and taking up to much of my time trying to figure out something that should work remotely if working locally.
6 Answers, 1 is accepted
Ok, I think we have a real answer why you're getting the below error, and it should explain your other symptoms as well:
error CS0103: The name 'Utility' does not exist in the current context
At the time you click Run List Remotely or Schedule Testlist we try to be very intelligent and only upload into our storage server the tests and supporting files that are actually needed by that specific test list. We don't blindly upload everything wholesale fashion. We are deliberately being selective for performance reasons. We don't want to blindly upload everything over the wire for large projects (those that are hundreds of MB in size). It would be far to slow to always upload the entire project for remote execution.
An example where things can break down (and is probably where things are failing for you) is where you create test list A and the tests contained in it rely on a static utility class contained in test B, but test B is not included in the test list and test B is not called/used via test-as-step. Then Test Studio will skip uploading test B to the storage service. It's not smart enough to scan the code to discover what ancillary classes or code files the tests rely on.
Since test B is missing from storage, the compile phase failed due to the missing code file. Since the compile phase failed, no bin folder gets created.
I suspect you're running into the same thing for "I noticed the Templates/Finance Admin folder does not get copied either". We're only going to push up what Test Studio recognizes will be used/needed by the test list.
Now the good news is there's a fairly easy workaround. Once the required supporting files do get uploaded they will live in storage service forever (unless you manually delete them). Once they exist in storage service the execution runner will pull everything, compile it as a whole and run the test list.
So the trick is to get your Globals test (and/or any other supporting files) to be uploaded at least once. There are two approaches you can take:
- Add Globals into the test list then Run List Remotely. Test Studio will then push it into storage service and your other tests can successfully reference it. Yes the runner will try to run it as a normal test, but if it's an empty test it will simply immediately pass and not effect the other test results.
- Reference Globals via Test-as-step in one of the other tests. Again yes it will be called as a subtest, but if i's void of any real steps, it will simply immediately return to the parent test.
Once the test has been pushed into storage it will stay there, which means you can then safely remove it from the test list... at least until the next time you make a change to the code contained in Globals. If you make a change you'll need to force it to upload once again.
We'll add ourselves an internal work item to better address this type of test project configuration in a future release i.e. a global static class buried inside the code of a test.
I tried the work around suggested, but did not fully work. If I include the tests containing the coded steps in the test list, then the list will run remotely. Currently the coded steps are nestled in a test-as-step. However, if I ever take the test with the coded steps out from the test list after the first run, I get back to the same problem.
I am able to reproduce the behavior. As you've stated, once you add the preceding test containing the coded steps in the test list, the list will run remotely. The sub test has to be placed before the test in the test list order. I've filed a feedback item to address this. You can follow its status and comment on the thread here.
I am encountering a compilation issue when running test list remotely o execution server.
Actually I added a .dll to the project on stand and when I run the test list remotely encountering an error of not able to find Assembly
Compile failed: c:\Users\aletc\AppData\Local\Temp\Projects\d041783c-d041-4360-8d0c-7201c385c7ae\AppraisalRequest\Tests\NewChattelRequest.tstest.cs(19,7) : error CS0246: The type or namespace name 'UtilityFunctions' could not be found (are you missing a using directive or an assembly reference?)
Just wondering how can I bring this dll to storage?
To make this work you have to copy your dll to the ROOT directory of project, then just refer it from that location.
Note this will work only if you put the dll in the root directory as it is described at the bottom of this article. Test Studio will not find references to a DLL in the subfolders of the project folder. These include: bin, Properties, obj, Data, Backup, TestResults, Results, TestLists, and Profiler Configurations.
Hope this helps.