Skip to content
This repository has been archived by the owner on Jan 8, 2023. It is now read-only.

Added TestOption to change xml result file location #60

Merged

Conversation

epsmae
Copy link

@epsmae epsmae commented Oct 12, 2016

We are running nunit test with a build server on an network android emulator.
For a more convenient access to the result file the destination file path and name should be settable. The default file location is on the app internal storage, which is more complex to access.

Copy link
Member

@rprouse rprouse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good, but they need to be included on all supported platforms.

CreateXmlResultFile = true,

// Choose a diffrent path for the xml result file
// ResultFilePath = Path.Combine(Environment.ExternalStorageDirectory.Path, Environment.DirectoryDownloads, "Nunit", "Results.xml")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be added to the iOS and UWP projects

@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto" package="nunit.runner.tests" android:versionCode="3" android:versionName="3.0">
<uses-sdk android:minSdkVersion="15" />
<application android:label="NUnit" android:icon="@drawable/icon"></application>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Permissions need to be set for other platforms

@rprouse
Copy link
Member

rprouse commented Oct 18, 2016

@epsmae are you able to make the requested changes, or would you like someone else to do the updates?

@ChrisMaddock ChrisMaddock added this to the 3.2 milestone Oct 19, 2016
@ChrisMaddock
Copy link
Member

ChrisMaddock commented Oct 19, 2016

Was adding things to the 3.2 milestone - will also throw this in. It'll also fix #58 👍

@epsmae
Copy link
Author

epsmae commented Oct 19, 2016

I will do it in the next days!

@ChrisMaddock
Copy link
Member

Hey @epsmae - is this ready for review? I haven't pulled it down to try it yet, but looks like it's implemented on every platform?

If it's good to go, it would be great if we can merge this before starting on #48. 😄

@epsmae
Copy link
Author

epsmae commented Oct 27, 2016

@ChrisMaddock - I think so, I did a simple test on an iphone and a windows 8.1 phone. As I hardly work with Xamarin IOS/ Windows Phone I would be Grateful if somebody could have a look and do some tests.

@ChrisMaddock
Copy link
Member

ChrisMaddock commented Oct 27, 2016

Great, thanks! I'll try and take a look tonight.

@rprouse, would you also mind taking a second look?

@rprouse
Copy link
Member

rprouse commented Oct 27, 2016

I will also have a look. Someone will need to resolve conflicts. @epsmae if you can merge latest from master it would save us some time. If not, I can do it, but it might mean opening a new PR since you are working on a fork. You will still get credit for the changes you made though 😄

Copy link
Member

@rprouse rprouse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good except for minor changes that I have requested. Once it is good, do you want one of us to merge from master and resolve the conflicts or can you do it?

@@ -47,9 +49,10 @@
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<MtouchArch>ARMv7, ARM64</MtouchArch>
<CodesignKey>iPhone Developer</CodesignKey>
<CodesignKey>iPhone Developer: Christian Schmid (R65G567HMV)</CodesignKey>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be removed.

@@ -25,6 +25,8 @@
<MtouchLink>None</MtouchLink>
<MtouchDebug>true</MtouchDebug>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<CodesignKey>iPhone Developer: Christian Schmid (R65G567HMV)</CodesignKey>
<CodesignProvision>dccfb495-a21d-4e42-8f9b-09f3126395e5</CodesignProvision>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to be removed.

<MtouchDebug>true</MtouchDebug>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<CodesignProvision>dccfb495-a21d-4e42-8f9b-09f3126395e5</CodesignProvision>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should revert all changes in this file.

@@ -53,7 +53,11 @@ public MainPage()
//TcpWriterParameters = new TcpWriterInfo("192.168.0.108", 13000),

// Creates a NUnit Xml result file on the host file system using PCLStorage library.
CreateXmlResultFile = false
CreateXmlResultFile = false,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've removed WP81 since you started this PR. Someone will need to resolve the merge conflicts. Sorry.

@@ -60,7 +60,7 @@ protected override void OnCreate(Bundle savedInstanceState)
CreateXmlResultFile = true,

// Choose a diffrent path for the xml result file
// ResultFilePath = Path.Combine(Environment.ExternalStorageDirectory.Path, Environment.DirectoryDownloads, "Nunit", "Results.xml")
ResultFilePath = Path.Combine(Environment.ExternalStorageDirectory.Path, Environment.DirectoryDownloads, "Nunit_123", "Results.xml")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you change Nunit_123 back?

await folder.CreateFolderAsync(segments[i + 1], CreationCollisionOption.OpenIfExists);
#if __DROID__
IFolder folder = await FileSystem.Current.GetFolderFromPathAsync(path, CancellationToken.None);
#elif __IOS__
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the Android and IOS code is the same, please change the first #if to #if __DROID__ || __IOS__

#elif __IOS__
IFolder folder = await FileSystem.Current.GetFolderFromPathAsync(path, CancellationToken.None);
#else
IFolder folder = await FileSystem.Current.GetFolderFromPathAsync(path.Replace('/', '\\'), CancellationToken.None);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, did you do the path replacement because it wasn't working? I thought Windows accepted the Linux path separators, but I might be wrong.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It crashed on the windows phone so I had to replace the slashes. It also doesn't work with Uri, I always thought it doesn't matter on the platform.

/// <summary>
/// File path for the xml result file
/// Default is [LocalStorage]/NUnitTestOutput/TestResults.xml
/// </summary>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm reading right, I think this comment is out-dated, default is now just in localstorage? Looks like the behaviour was changed since the comment was written. ☺

@ChrisMaddock
Copy link
Member

Sorry both, was hoping to look at this the other day, but this weeks just ran away from me! Looks good, @epsmae, I just had a minor aesthetic comment on top of what @rprouse has already added. 🙂 Will be a nice addition!

@epsmae epsmae closed this Nov 2, 2016
@epsmae epsmae force-pushed the pull-request-result-filepath-option branch from 8f894a4 to 3542be4 Compare November 2, 2016 16:36
@epsmae
Copy link
Author

epsmae commented Nov 2, 2016

Sorry, I did something foolish. Is it possible to reopen the pull request?

@ChrisMaddock
Copy link
Member

ChrisMaddock commented Nov 2, 2016

The pull request is linked to the branch on your repo - I can't currently reopen it as There are no new commits on the epsmae:pull-request-result-filepath-option branch.

Just push the code back to your branch, and you/we should be able to reopen it. If it all goes wrong, just open up an new PR, don't worry about it. 😄

You haven't accidentally deleted the changes completely, have you? I think I still have a copy locally if so. 😄

@epsmae epsmae reopened this Nov 3, 2016
@rprouse
Copy link
Member

rprouse commented Nov 4, 2016

The changes you have up so far look good. Someone just needs to resolve merge conflicts. @epsmae can you do that, or would you like one of us to do it?

@ChrisMaddock ChrisMaddock merged commit 0fa532e into nunit:master Nov 6, 2016
@ChrisMaddock
Copy link
Member

All looks good to me - merged! Thanks @epsmae!

@epsmae
Copy link
Author

epsmae commented Nov 7, 2016

@ChrisMaddock When a IPhone is connected it is listed in iTunes ( V9.1 and later). As the UIFileSharingEnabled key is set files can be transfered from / to the device within the app shared folder.

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

Successfully merging this pull request may close these issues.

3 participants