jediwhale / fitsharp

Functional testing tools for .NET
http://fitsharp.github.io
Other
152 stars 73 forks source link

Need very old versions of Fit and FitLibrary for work on legacy project. #186

Open amine-aboufirass opened 1 year ago

amine-aboufirass commented 1 year ago

I'm working on a legacy project which makes use of two DLLs:

The usages of fit.dll in the source code include the following:

The usages of FitLibrary.dll in the source code include the following:

I did some digging and checked some of the earliest tagged versions of fitsharp on this repository, but I could find no source files called FileRunner. So I digged deeper and discovered the 1.x versions of Fit on sourceforge which do contain a source file named FileRunner.

I'm assuming the legacy project is making use of one of these 1.x versions, however when I unzipped the downloads from source forge I could find no files with the name FitLibrary. I checked again on source forge and found only this which doesn't seem to have any .NET binaries or source.

Where can I find the version of FitLibrary corresponding to the 1.x versions of Fit?

Thanks

jediwhale commented 1 year ago

Maybe something here? https://sourceforge.net/projects/fitnessedotnet/

amine-aboufirass commented 1 year ago

@jediwhale The decompiled source for FileRunner.cs shows assembly version 1.2.7467.21573. So I'm thinking it's maybe this release? Since I could not find any downloads for 1.2 on SourceForge I tried getting it to work with the arithmetic.html example for release 1.1. It does generate a results file, but I'm getting fit.FitVersionFixture related errors.

I also had a look at the commit history on this repo, and commit 62fc9c6b13c4c is labelled as "release 1.2". However, I had a look at the source files for that commit and there are no files or classes with the name FileRunner, so I'm not sure if that's the correct one.

Any help or pointers would be extremely welcome.

jediwhale commented 1 year ago

Some old stuff I found fitLibrary.zip

amine-aboufirass commented 1 year ago

Nevermind, I ended up decompiling the DLLs using ilspycmd and now have access to the source code. I created a project out of it and was able to reproduce the behavior I was experiencing when calling runFile.exe arithmetic.html arithmetic.out.html Fixures.dll.

I keep getting the following error:

System.TypeInitializationException: The type initializer for 'fit.FitVersionFixture' threw an exception.
 ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
File name: 'System.Configuration.ConfigurationManager, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
   at fit.FitVersionFixture.Reset()
   at fit.FitVersionFixture..cctor() in C:\Users\aa\Desktop\TEMP\fit-testing-library\ExamplesDotnet\fit-decompiled\fit\FitVersionFixture.cs:line 13

   --- End of inner exception stack trace ---
   at fit.FitVersionFixture.get_IsStandard() in C:\Users\aa\Desktop\TEMP\fit-testing-library\ExamplesDotnet\fit-decompiled\fit\FitVersionFixture.cs:line 9
   at fit.HtmlString.TextOutput.Append(Substring theInput) in C:\Users\aa\Desktop\TEMP\fit-testing-library\ExamplesDotnet\fit-decompiled\fit\HtmlString.cs:line 27
   at fit.HtmlString.UnFormat(String theInput) in C:\aa\Desktop\TEMP\fit-testing-library\ExamplesDotnet\fit-decompiled\fit\HtmlString.cs:line 127
   at fit.HtmlString.ToPlainText() in C:\Users\aa\Desktop\TEMP\fit-testing-library\ExamplesDotnet\fit-decompiled\fit\HtmlString.cs:line 108
   at fit.Parse.HtmlToText(String theHtml) in C:\Users\aa\Desktop\TEMP\fit-testing-library\ExamplesDotnet\fit-decompiled\fit\Parse.cs:line 240
   at fit.Parse.get_Text() in C:\Users\aa\Desktop\TEMP\fit-testing-library\ExamplesDotnet\fit-decompiled\fit\Parse.cs:line 107
   at fit.Fixture.DoTables(Parse tables) in C:\Users\aa\Desktop\TEMP\fit-testing-library\ExamplesDotnet\fit-decompiled\fit\Fixture.cs:line 111

I tried debugging it and was able to determine that FileVersionFixture throws the error. I think this may have something to do with it, since arithmetic.html runs just fine with the Fit 1.1 executable from source forge.

jediwhale commented 1 year ago

You can probably just strip out all the logic from FitVersionFixture since your legacy project likely isn't using it. e.g. public static bool IsStandard {get { return true;}}

amine-aboufirass commented 1 year ago

FitVersionFixture is part of the DLL that the legacy project is using, so I'm definitely not comfortable just chucking it out.

In any case, I was able to work around it by adding the following configuration file in the bin directory of my main console application:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <appSettings>
        <add key="fitVersion" value="std" />
    </appSettings>
</configuration>

This basically forces the FitVersionFixture.IsStandard property to true, and I don't get the version related error anymore. Now my output is as follows for arithmetic.html:

37 right, 10 wrong, 0 ignored, 3 exceptions

Which is slightly different from the output for Fit Version 1.1:

37 right, 10 wrong, 0 ignored, 2 exceptions

Also, when I look at the respective output files, there are a few differences. Most notably the output for my decompiled version lacks the coloring (red, green, yellow) for the table cells. I checked the code and it looks like 1.1 is explicitly setting the colors using the bgcolor property of the HTML element while my decompiled version is just setting a class called pass or fail. I'm guessing there's some CSS file that gets used as a resource somewhere which didn't get baked into the DLL I decompiled.