Changeset 11789


Ignore:
Timestamp:
01/16/15 14:05:23 (5 years ago)
Author:
jkarder
Message:

#2262: refactored scripting unit tests

  • changed code template loading
  • minor code changes
Location:
trunk/sources/HeuristicLab.Tests
Files:
2 added
8 deleted
2 edited
14 copied
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Tests/HeuristicLab.Scripting-3.3/GAQAPScriptTest.cs

    r11787 r11789  
    7373      #endregion
    7474      #region Code
    75       script.Code = ScriptingUtils.LoadScriptCodeFromFile(ScriptFileName);
     75      script.Code = ScriptSources.GAQAPScriptSource;
    7676      #endregion
    7777      return script;
  • trunk/sources/HeuristicLab.Tests/HeuristicLab.Scripting-3.3/GUIAutomationScriptTest.cs

    r11787 r11789  
    3131    private const string ScriptItemName = "GUI Automation Script";
    3232    private const string ScriptItemDescription = "A script that runs a genetic algorithm on a traveling salesman problem with 5 different settings for population sizes and with 10 repetitions, then opens a bubble chart of the results and chooses the appropriate values for x and y axis automatically";
    33     private const string ExperimentVariableName = "experiment";
    3433
    3534    [TestMethod]
     
    4847      };
    4948      #region Code
    50       script.Code = ScriptingUtils.LoadScriptCodeFromFile(ScriptFileName);
     49      script.Code = ScriptSources.GUIAutomationScriptSource;
    5150      #endregion
    5251      return script;
  • trunk/sources/HeuristicLab.Tests/HeuristicLab.Scripting-3.3/GridSearchRFClassificationScriptTest.cs

    r11787 r11789  
    7373      #endregion
    7474      #region Code
    75       script.Code = ScriptingUtils.LoadScriptCodeFromFile(ScriptFileName);
     75      script.Code = ScriptSources.GridSearchRFClassificationScriptSource;
    7676      #endregion
    7777      return script;
  • trunk/sources/HeuristicLab.Tests/HeuristicLab.Scripting-3.3/GridSearchRFRegressionScriptTest.cs

    r11787 r11789  
    7373      #endregion
    7474      #region Code
    75       script.Code = ScriptingUtils.LoadScriptCodeFromFile(ScriptFileName);
     75      script.Code = ScriptSources.GridSearchRFRegressionScriptSource;
    7676      #endregion
    7777      return script;
  • trunk/sources/HeuristicLab.Tests/HeuristicLab.Scripting-3.3/GridSearchSVMClassificationScriptTest.cs

    r11787 r11789  
    7373      #endregion
    7474      #region Code
    75       script.Code = ScriptingUtils.LoadScriptCodeFromFile(ScriptFileName);
     75      script.Code = ScriptSources.GridSearchSVMClassificationScriptSource;
    7676      #endregion
    7777      return script;
  • trunk/sources/HeuristicLab.Tests/HeuristicLab.Scripting-3.3/GridSearchSVMRegressionScriptTest.cs

    r11787 r11789  
    7373      #endregion
    7474      #region Code
    75       script.Code = ScriptingUtils.LoadScriptCodeFromFile(ScriptFileName);
     75      script.Code = ScriptSources.GridSearchSVMRegressionScriptSource;
    7676      #endregion
    7777      return script;
  • trunk/sources/HeuristicLab.Tests/HeuristicLab.Scripting-3.3/OSGARastriginScriptTest.cs

    r11787 r11789  
    7272      #endregion
    7373      #region Code
    74       script.Code = ScriptingUtils.LoadScriptCodeFromFile(ScriptFileName);
     74      script.Code = ScriptSources.OSGARastriginScriptSource;
    7575      #endregion
    7676      return script;
  • trunk/sources/HeuristicLab.Tests/HeuristicLab.Scripting-3.3/ScriptingUtils.cs

    r11735 r11789  
    2121
    2222using System;
    23 using System.IO;
    2423using System.Threading;
    2524using HeuristicLab.Scripting;
     
    4746      return (T)a.VariableStore[resultName];
    4847    }
    49 
    50     public static string LoadScriptCodeFromFile(string scriptName) {
    51       string path = Path.Combine(ScriptSourcesDirectory, scriptName + ScriptSourceFileExtension);
    52       return File.ReadAllText(path);
    53     }
    5448  }
    5549}
  • trunk/sources/HeuristicLab.Tests/HeuristicLab.Tests.csproj

    r11703 r11789  
    522522    <Compile Include="HeuristicLab.Problems.VehicleRouting-3.4\VRPInstancesTest.cs" />
    523523    <Compile Include="HeuristicLab.Random-3.3\RandomEnumerableSampleTest.cs" />
    524     <Compile Include="HeuristicLab.Scripting-3.3\Scripts\GAQAPScriptTest.cs" />
    525     <Compile Include="HeuristicLab.Scripting-3.3\Scripts\GridSearchRFClassificationScriptTest.cs" />
    526     <Compile Include="HeuristicLab.Scripting-3.3\Scripts\GridSearchRFRegressionScriptTest.cs" />
    527     <Compile Include="HeuristicLab.Scripting-3.3\Scripts\GridSearchSVMClassificationScriptTest.cs" />
    528     <Compile Include="HeuristicLab.Scripting-3.3\Scripts\GridSearchSVMRegressionScriptTest.cs" />
     524    <Compile Include="HeuristicLab.Scripting-3.3\GAQAPScriptTest.cs" />
     525    <Compile Include="HeuristicLab.Scripting-3.3\GridSearchRFClassificationScriptTest.cs" />
     526    <Compile Include="HeuristicLab.Scripting-3.3\GridSearchRFRegressionScriptTest.cs" />
     527    <Compile Include="HeuristicLab.Scripting-3.3\GridSearchSVMClassificationScriptTest.cs" />
     528    <Compile Include="HeuristicLab.Scripting-3.3\GridSearchSVMRegressionScriptTest.cs" />
     529    <Compile Include="HeuristicLab.Scripting-3.3\Script Sources\ScriptSources.Designer.cs">
     530      <AutoGen>True</AutoGen>
     531      <DesignTime>True</DesignTime>
     532      <DependentUpon>ScriptSources.resx</DependentUpon>
     533    </Compile>
    529534    <Compile Include="HeuristicLab.Scripting-3.3\ScriptingUtils.cs" />
    530     <Compile Include="HeuristicLab.Scripting-3.3\Scripts\GUIAutomationScriptTest.cs" />
    531     <Compile Include="HeuristicLab.Scripting-3.3\Scripts\OSGARastriginScriptTest.cs" />
     535    <Compile Include="HeuristicLab.Scripting-3.3\GUIAutomationScriptTest.cs" />
     536    <Compile Include="HeuristicLab.Scripting-3.3\OSGARastriginScriptTest.cs" />
    532537    <Compile Include="Properties\AssemblyInfo.cs" />
    533     <Compile Include="Test Resources\Script Sources\GridSearch_RF_Classification_Script.cs">
    534       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    535     </Compile>
    536     <Compile Include="Test Resources\Script Sources\GridSearch_RF_Regression_Script.cs">
    537       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    538     </Compile>
    539     <Compile Include="Test Resources\Script Sources\GridSearch_SVM_Classification_Script.cs">
    540       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    541     </Compile>
    542     <Compile Include="Test Resources\Script Sources\GridSearch_SVM_Regression_Script.cs">
    543       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    544     </Compile>
    545     <Compile Include="Test Resources\Script Sources\GA_QAP_Script.cs">
    546       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    547     </Compile>
    548     <Compile Include="Test Resources\Script Sources\OSGA_Rastrigin_Script.cs">
    549       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    550     </Compile>
    551     <Compile Include="Test Resources\Script Sources\GUI_Automation_Script.cs">
     538    <Compile Include="HeuristicLab.Scripting-3.3\Script Sources\GridSearchRFClassificationScriptSource.cs">
     539      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     540    </Compile>
     541    <Compile Include="HeuristicLab.Scripting-3.3\Script Sources\GridSearchRFRegressionScriptSource.cs">
     542      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     543    </Compile>
     544    <Compile Include="HeuristicLab.Scripting-3.3\Script Sources\GridSearchSVMClassificationScriptSource.cs">
     545      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     546    </Compile>
     547    <Compile Include="HeuristicLab.Scripting-3.3\Script Sources\GridSearchSVMRegressionScriptSource.cs">
     548      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     549    </Compile>
     550    <Compile Include="HeuristicLab.Scripting-3.3\Script Sources\GAQAPScriptSource.cs">
     551      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     552    </Compile>
     553    <Compile Include="HeuristicLab.Scripting-3.3\Script Sources\OSGARastriginScriptSource.cs">
     554      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     555    </Compile>
     556    <Compile Include="HeuristicLab.Scripting-3.3\Script Sources\GUIAutomationScriptSource.cs">
    552557      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    553558    </Compile>
     
    592597    </Content>
    593598  </ItemGroup>
    594   <ItemGroup />
     599  <ItemGroup>
     600    <EmbeddedResource Include="HeuristicLab.Scripting-3.3\Script Sources\ScriptSources.resx">
     601      <Generator>ResXFileCodeGenerator</Generator>
     602      <LastGenOutput>ScriptSources.Designer.cs</LastGenOutput>
     603      <CustomToolNamespace>HeuristicLab.Tests</CustomToolNamespace>
     604    </EmbeddedResource>
     605  </ItemGroup>
    595606  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
    596607  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Note: See TracChangeset for help on using the changeset viewer.