VSTSã䜿çšãããšãããŸããŸãªç°å¢ã§ãœãããŠã§ã¢ã®å±éãšãã¹ããèªååã§ããŸãã ç¶ç¶çã€ã³ãã°ã¬ãŒã·ã§ã³ã®æ¬è³ªã¯ããããžã§ã¯ãã®é »ç¹ãªèªåã¢ã»ã³ããªãå®è¡ããŠãã€ã³ãã°ã¬ãŒã·ã§ã³ã®åé¡ãè¿ éã«ç¹å®ããŠè§£æ±ºããããšã§ãã ç¹ã«ãCIã䜿çšãããšãã¢ããªã±ãŒã·ã§ã³ã®ååž°ãã¹ããèªååã§ããŸãã
VSTSã®æ©èœã®æŠèŠãšããŠãåçŽãªUWPã¢ããªã±ãŒã·ã§ã³ã®åäœãã¹ããšã®ç¶ç¶ççµ±åãå ¬éããã³æ§æããããšãææ¡ããŸãã
ç°¡åãªUWPã¢ããªã±ãŒã·ã§ã³ãããžã§ã¯ããäœæããŠã1ã€ã®ã¡ãœãããäœæããŸãã
public double CalcSquere(string t) { double res = Convert.ToDouble(t); res = res * res; return res; }
ãœãªã¥ãŒã·ã§ã³ã§ãåäœãã¹ãïŒUnit Test AppïŒãå«ããããžã§ã¯ããè¿œå ããŸãã æ £äŸã«ãããã¹ããããžã§ã¯ãã«ååãä»ããæåŸã«ãã¹ããè¿œå ããããšããå§ãããŸãã ãããã£ãŠãVSTSããã³TFSã§ãã¹ãå®è¡ãæ§æããæ¹ãç°¡åã§ãã ã¡ã€ã³ãããžã§ã¯ããžã®ãªã³ã¯ãè¿œå ããŸãã
UnitTest.csã®ååãMainPageTests.csã«å€æŽããŸãã ãã¡ã€ã«ã«ãã®ãããªååãä»ããããŠããå Žåããã®ã¯ã©ã¹ãæ£ç¢ºã«ãã¹ãããŠãããã®ãç解ãããããªããŸãã
ã¡ãœãããè¿œå ããŸãã
[TestMethod] public void CalcSquere_5_Result25() { Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { SimpleApp.MainPage mp = new SimpleApp.MainPage(); double expected = mp.CalcSquere("5"); Assert.AreEqual(expected, 25, "Wrong"); }).AsTask().Wait(); }
ã¡ãœããã³ãŒãã¯UIã¹ã¬ããããèµ·åãããŸãã åå空éãè¿œå ããããšãå¿ããªãã§ãã ãã
using Windows.UI.Core;
ãããžã§ã¯ããäœæãããšãã«ããŒãžã§ã³ç®¡çã·ã¹ãã ãè¿œå ããªãã£ãå Žåã¯ãããã§è¿œå ããå¿ èŠããããŸãã
gitignoreãªã¹ãããäž¡æ¹ã®ãããžã§ã¯ãã®èšŒææžãåé€ããå¿ èŠããããŸãïŒããããªããšãVSTSãã«ãã¯å€±æããŸãïŒã
VSTSã§å ¬éããŠããŸãã ããŒã ãšã¯ã¹ãããŒã©ãŒãŠã£ã³ããŠã«ç§»åãã[åæ]ãã¯ãªãã¯ããŸã
å ¬éåŸããã«ãå®çŸ©ãäœæã§ããŸãã ãã ãããã®åã«ããã«ããšãŒãžã§ã³ããæ§æããå¿ èŠããããŸãã å®éãåäœãã¹ããå®è¡ããã«ã¯ãã«ã¹ã¿ã ãšãŒãžã§ã³ããäœæããå¿ èŠããããŸãã
ããã©ã«ãã§ã¯ã3ã€ã®ãšãŒãžã§ã³ãããŒã«ããããŸãã
ããã©ã«ãããŒã«ã¯ ããªã¢ãŒããµãŒããŒã«ã€ã³ã¹ããŒã«ãããŠãããšãŒãžã§ã³ãã«äœ¿çšãããŸãã
ãã¹ãããŒã«ã¯ ãVSTSããã³TFSãµãŒããŒã«ããã©ã«ãã§ã€ã³ã¹ããŒã«ããããšãŒãžã§ã³ãã«äœ¿çšãããŸãã
ãã¹ããããLinuxããŒã«ã䜿çšãããšããšãŒãžã§ã³ããèšå®ããªããŠãLinuxãã·ã³ãæäœã§ããŸãã vsts-agent-dockerã³ã³ããããã«ãŒå ã®Ubuntu Linuxãã¹ãã§åäœããŸãã
以äžã®è¡šã¯ãã«ã¹ã¿ã ãšãŒãžã§ã³ããå¿ èŠã§ããããšã瀺ãå¯èœãªã·ããªãªã瀺ããŠããŸãã
ã¹ã¯ãªãã | ã«ã¹ã¿ã ãšãŒãžã§ã³ã | ãã¹ãããããã«ããšãŒãžã§ã³ã |
UWPã¢ã»ã³ããªã®äž»ãªæ©èœïŒ.NETãã€ãã£ããå«ãïŒ | X | X |
ãµã€ãããŒãã£ã³ã°çšã®ããã±ãŒãžã®äœæ | X | X |
Windowsã¹ãã¢çšã®ããã±ãŒãžãäœæãã | X | X |
ãµãŒãããŒãã£ã®èšŒææžã䜿çšãã | X | |
Windows SDKã®ã«ã¹ã¿ã ããŒãžã§ã³çšã«ãã«ããã | X | |
åäœãã¹ãã®å®è¡ | X | |
ã€ã³ã¯ãªã¡ã³ã¿ã«ãã«ãã䜿çšãã | X |
ãã«ããšãŒãžã§ã³ããäœæããã«ã¯ãããŒãœãã«ããŒã¯ã³ãäœæããå¿ èŠããããŸãã ãããã¡ã€ã«ã¢ã€ã³ã³ãã¯ãªãã¯ããŠã[ã»ãã¥ãªãã£]ã«ç§»åããŸãã
è¿œå ãã¯ãªãã¯ããŸãã ãšãŒãžã§ã³ãããŒã«ã®ã¿ãéžæããŸãïŒèªã¿åãã管çïŒ
ããŒã¯ã³ã®äœæïŒäžïŒãã¯ãªãã¯ããå€ãã³ããŒããŠã³ã³ãã¥ãŒã¿ãŒã«ä¿åããŸã
ãã®ã¡ãã»ãŒãžã¯ãããŒã¯ã³ã®å€ãä»ããââä¿åããªããšããããååŸã§ããªãããšãèŠåããŠããŸãã ãšãŒãžã§ã³ãã«è¡ã
ãšãŒãžã§ã³ããäœæãããåŸããšãŒãžã§ã³ãããã®ãŠã£ã³ããŠã«è¡šç€ºãããŸãããçŸæç¹ã§ã¯ç©ºã§ãã
[ãšãŒãžã§ã³ãã®ããŠã³ããŒã]ãã¯ãªãã¯ããŸãã
vsts-agent-win7-x64-2.110.0.zipã¢ãŒã«ã€ããããŠã³ããŒãããŸãã CïŒ\ agentãã©ã«ããŒã«è§£åããŸãïŒååãšå Žæã¯æ£ç¢ºã«åãã§ããå¿ èŠã¯ãããŸããïŒ
éçºããŠããåããã·ã³ã«ãšãŒãžã§ã³ããã€ã³ã¹ããŒã«ããå¿ èŠã¯ãããŸããã ä»»æã®ãã·ã³ã«ã€ã³ã¹ããŒã«ã§ããŸãã çè«çã«ã¯ãAzureä»®æ³ãã·ã³ã«ã€ã³ã¹ããŒã«ã§ããŸãã åææ¡ä»¶-64ãããããŒãžã§ã³ã®Windowsãã€ã³ã¹ããŒã«ããå¿ èŠããããŸãã ã»ãšãã©ã®ã·ããªãªã§ã¯ãNuGetãšå ±ã«ãã·ã³ã«Visual Studioãã€ã³ã¹ããŒã«ããå¿ èŠããããŸãã
PowerShellãèµ·åããŠãCïŒ\ agentãã£ã¬ã¯ããªã«ç§»åããŸãã èšå®å¯èœã ããããã¡ã€ã«ã\ Config.cmdãå®è¡ãããªã¯ãšã¹ãã«å¿çããŸãã ãµãŒããŒã®URLãå ¥åããèªèšŒã®çš®é¡ãéžæããŸãã VSTSã®å Žåãå©çšå¯èœãªãªãã·ã§ã³ã¯PATïŒPersonal Access TokenïŒã®ã¿ã§ãã ããã¯ãå°ãåã«äœæãããŸãã«ãã®ããŒã¯ã³ã§ãã 次ã«ãããŒã«ãšãšãŒãžã§ã³ãåãéžæããŸãã ç§ã®å Žåããããã®å€ã¯ããã©ã«ãã§æ®ãããŠããŸããã
æ§æã®æåŸã®ã¹ãããã¯ããšãŒãžã§ã³ãããµãŒãã¹ãšããŠéå§ãããã©ããã®è³ªåã§ãã ãã¹ããå¿ èŠãªå ŽåããšãŒãžã§ã³ãã¯æåã§éå§ãããŸãã ãµãŒãã¹ãšããŠã€ã³ã¹ããŒã«ããå¿ èŠã¯ãããŸããã
æ³šïŒ ã\ Config removeã䜿çšããŠãšãŒãžã§ã³ããåé€ã§ããŸãããã®å ŽåãPATããŒã¯ã³ãå ¥åããå¿ èŠããããŸãã
èšå®ã®è©³çŽ°ã¯ãã¡ãïŒ Windowsã§ã®ãšãŒãžã§ã³ãã®å±é
ãã«ããäœæããŸããã
ãŠãããŒãµã«ãã©ãããã©ãŒã ã®ãã³ãã¬ãŒããéžæãã
ãããŠãContinousçµ±åãæ§æããŸãïŒå察åŽã®ããã¯ã¹ããã§ãã¯ããŸãïŒã ãšãŒãžã§ã³ãããŒã«ã®ããã©ã«ãã®éžæ
ãã®çµæã次ã®ãŠã£ã³ããŠã衚瀺ãããŸãã
ã¢ããªã±ãŒã·ã§ã³ã®ãã«ãã®çµæãšããŠååŸããããã¡ã€ã«ã®ã³ããŒãäœæããäºå®ããªãå Žåãã¢ãŒãã£ãã¡ã¯ãã®å ¬éæé ïŒArtifactïŒããããïŒãã¹ããããããåé€ããŠãæéãç¯çŽããããšãã§ããŸãïŒãã®ã³ããŒã¯ãããšãã°ãã¯ã©ã€ã¢ã³ãã«è»¢éãããããªãªãŒã¹ã«éä¿¡ããããæåã§ãã¹ããããã§ããŸãïŒã
ãã«ããé«éåããããã«ïŒãã¹ãã«åæ Œããããšã ãã確èªããå¿ èŠãããå ŽåïŒããœãªã¥ãŒã·ã§ã³ã®ãã«ãã¹ãããã§1ã€ã®ãã©ãããã©ãŒã ïŒx64ïŒãæå®ã§ããŸãã ããã¯CIã«æšå¥šãããŸãã
ãã®å Žåããã«ãèšå®ã®MSBuild Argumentsè¡ãå€æŽããŸãã AppxBundleãNeverã«èšå®ããŸãã
/ pïŒAppxBundlePlatforms = "$ïŒBuildPlatformïŒ" / pïŒAppxPackageDir = "$ïŒBuild.ArtifactStagingDirectoryïŒ\ AppxPackages \\" / pïŒAppxBundle = Never / pïŒUapAppxPackageBuildMode = StoreUpload
ãã®è¡ã®$ïŒBuild.ArtifactStagingDirectoryïŒã¯ãææç©ãã©ã«ããŒãžã®ãã¹ã瀺ãå€æ°ã§ãã ç§ã®ãã·ã³ã«ãšãŒãžã§ã³ãããšãŒãžã§ã³ããã©ã«ããŒã®Cãã©ã€ãã«ã€ã³ã¹ããŒã«ãããŠããããã®æ§æäžã«_workãšããååã®äœæ¥ãã©ã«ããŒãéžæããå Žåããã®ãã©ã«ããŒãžã®ãã¹ã¯æ¬¡ã®ãšããã§ãã
CïŒ\ãšãŒãžã§ã³ã\ _work \ 1 \ a
ããã§1ã¯ãããžã§ã¯ãçªå·ã§ã
ãã¹ãŠã®å€æ°ã®ãªã¹ãã¯ã次ã®ããŒãžã«ãããŸãã ãã«ãå€æ°ã䜿çšãã
åºæ¬èšå®ïŒ
ãã³ãã«ïŒããŸããŸãªããã»ããµã¢ãŒããã¯ãã£çšã®ã¢ããªã±ãŒã·ã§ã³ããã±ãŒãžãå«ããã¡ã€ã«ïŒãçæããå Žåã¯ããããžã§ã¯ãèšå®ãå€æŽããå¿ èŠããããŸãã ãŸãã¯ã.csprojãããžã§ã¯ããã¡ã€ã«ãéãã次ã®å€æŽãè¡ããŸãã
ãããžã§ã¯ããã¡ã€ã«ã§ã¯ãæåã®èŠçŽ ã®æåŸã«ãããã¹ãåäœ
<PropertyGroup>
è¿œå ïŒ
<AppxBundle>Never</AppxBundle>
ãããŠãã¢ããªã±ãŒã·ã§ã³ãããžã§ã¯ããã¡ã€ã«ã«ä»¥äžãè¿œå ããŸãã
<AppxBundle>Always</AppxBundle>
ãããã®å€æŽåŸãAppxBundleãã©ã¡ãŒã¿ãŒã¯ããã®å€ãšå ±ã«MSBuild Argumentsè¡ããå®å šã«åé€ã§ããŸãïŒãŸãã¯ãå€ãAuto-/ pã«èšå®ããŸãïŒAppxBundle = AutoïŒ
ãã®ãªãã·ã§ã³ã¯CDã«é©ããŠããŸãã
ãã¹ããããïŒãããŠç§ãã¡ã®å Žåã¯ããã§ãïŒãšããèŠæãããã®ã§ãã¹ããããè¿œå ããå¿ èŠããããŸã
ã¿ã¹ã¯éžæãŠã£ã³ããŠã§ãVisual Studio Testãè¿œå ããŸãã ãã¹ãã¢ã»ã³ããªãžã®ãã¹ãæå®ãã
ç§ã®å Žåãããã¯æ¬¡ã®ãšããã§ãã
$ïŒBuild.ArtifactStagingDirectoryïŒ\ AppxPackages \ SimpleAppTests_1.0.0.0_x64_Test \ SimpleAppTests_1.0.0.0_x64.appx
ä»ã®å¯èœãªãã¹ãèšå®ã¯ã次ã®ãªã³ã¯ã§èª¬æãããŠããŸãïŒ Visual Studio Test
åäœãã¹ãã®å ŽåããšãŒãžã§ã³ããã€ã³ã¿ã©ã¯ãã£ãã«ïŒã€ãŸããã¹ã¯ãªããã\ Run.cmdã䜿çšããŠïŒèµ·åããå¿ èŠããããŸãã
ããã«ãã¢ããªã±ãŒã·ã§ã³èšŒææžïŒã¡ã€ã³ã¢ããªã±ãŒã·ã§ã³ãšåäœãã¹ãã¢ããªã±ãŒã·ã§ã³ã®äž¡æ¹ïŒãããŒã«ã«ãã·ã³ãªããžããªïŒTrusted PeopleïŒã«ã€ã³ã¹ããŒã«ãããŠããå¿ èŠããããŸãïŒ* .pfxãã¡ã€ã«ãããã«ã¯ãªãã¯ããã ãã§ã€ã³ã¹ããŒã«ã§ããŸãïŒã ãšãŒãžã§ã³ããã€ã³ã¹ããŒã«ãããŠããã®ãšåããã·ã³ã«èšŒææžãã€ã³ã¹ããŒã«ããå¿ èŠããããŸãã
ãã¹ããå®è¡ãããšãã«ããšã©ãŒãçºçããå ŽåããããŸãã
...ïŒ0x5B4ïŒæäœãã¿ã€ã ã¢ãŠãããŸããã 30ç§ä»¥å ã«Windowsã¢ããªããã±ãŒãžãã€ã³ã¹ããŒã«ã§ããŸããã
ãã®å Žåãèµ·åã«å²ãåœãŠãããæéã人çºçã«å¢ããããšãã§ããŸãã ããã¯ã .runsettingsãã¡ã€ã«ãäœæããããšã«ããè¡ãããŸãã ãã®å Žåã®ãã¡ã€ã«ã®æå°ã³ã³ãã³ãã¯æ¬¡ã®ãšããã§ãã
<?xml version="1.0" encoding="utf-8"?> <RunSettings> <!-- Configurations that affect the Test Framework --> <RunConfiguration> <!-- [x86] | x64 - You can also change it from menu Test, Test Settings, Default Processor Architecture --> <TargetPlatform>x64</TargetPlatform> </RunConfiguration> <!-- Adapter Specific sections --> <!-- MSTest adapter --> <MSStoreTest> <AppxInstallTimeout>240000</AppxInstallTimeout> </MSStoreTest> </RunSettings>
ããã§ããã¹ãããã¢ãŒããã¯ãã£ã®ããã±ãŒãžãéžæããã¢ããªã±ãŒã·ã§ã³ã®ã€ã³ã¹ããŒã«ã®å¶éæéã240ç§ã«èšå®ããŸãã
éåžžããã¡ã€ã«ã¯ã¢ããªã±ãŒã·ã§ã³ã®ã«ãŒããã£ã¬ã¯ããªã«äœæãããVSTSãã«ãèšå®ã§æå®ãããŸãã
ãã¹ãã®æ£åžžãªæ§ç¯ãšå®è¡ã®çµæã¯ä»¥äžã«è¡šç€ºãããŸãã
ãã¹ãã®è©³çŽ°ãŠã£ã³ããŠïŒ
ãã®ãŠã£ã³ããŠãããæ°ãããã°ãäœæããããéçºã¿ã¹ã¯ãšã®é¢é£ä»ãããã¹ããããã§ããŸãã
çºè¡äŸ¡æ ŒïŒå°èŠæš¡ãªéçºããŒã ã®ã»ãšãã©ã®æ©èœã¯ç¡æã§ãïŒã¯ã¬ãžããã«ãŒããã¢ã«ãŠã³ãã«ãªã³ã¯ããå¿ èŠã¯ãããŸããïŒã ãã©ã€ããŒããªããžããªã§ç¡å¶éãã¿ã¹ã¯äœæã ããã«ããã©ã€ããŒããã€ãã©ã€ã³ãæäŸããïŒ åæãã€ãã©ã€ã³ ïŒã1ã€ã®ãã«ããš1ã€ã®ãªãªãŒã¹ãåæã«å®è¡ã§ããŸãã è€æ°ã®ãã«ããåæã«å®è¡ã§ããŸããããããã¯æ¬¡ã ã«é çªã«å®è¡ãããŸãã ããã«ããã¹ãããããšãŒãžã§ã³ãã1ãæããã240åéç¡æã§äœ¿çšã§ããŸãïŒåãã«ããŸãã¯ãªãªãŒã¹ã¯30å以äžç¶ãããšã¯ã§ããŸããïŒã
倧èŠæš¡ãªéçºããŒã ã®äŸ¡æ Œã«ã€ããŠã¯ãVisual Studio Team Servicesã®äœ¿çšæéãã芧ãã ããã
å ¬åŒããã¥ã¢ã«ïŒ UWPã¢ããªã±ãŒã·ã§ã³ã®èªåã¢ã»ã³ããªã®ã»ããã¢ãã