jediwhale / fitsharp

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

Cant get fitsharp working on linux #163

Closed sgtobin closed 3 years ago

sgtobin commented 4 years ago

Using this Suite.config file

<?xml version="1.0" encoding="utf-8"?>
<suiteConfig>
    <ApplicationUnderTest>
        <AddAssembly>AcceptanceTests.dll</AddAssembly>
        <AddNamespace>Acceptance.Tests</AddNamespace>
    </ApplicationUnderTest>
    <Settings>
        <Runner>fitnesse.fitserver.FitServer</Runner>
    </Settings>
</suiteConfig>

Using the following docker file...

FROM mcr.microsoft.com/dotnet/core/sdk:2.2

RUN apt-get update -qq && \
    apt-get install -y nano unzip wget openssl ca-certificates

RUN apt-get install -y openjdk-8-jdk

ENV FITNESSE_RELEASE 20190716

RUN adduser --disabled-login -u 666 fitnesse && \
    mkdir /opt/fitnesse && \
    chown fitnesse.fitnesse /opt/fitnesse

RUN curl -fsSL -o /usr/local/lib/fitnesse-standalone.jar "http://www.fitnesse.org/fitnesse-standalone.jar?responder=releaseDownload&release=$FITNESSE_RELEASE"

COPY fit.dll /opt/fitnesse/
COPY fitSharp.dll /opt/fitnesse/
COPY Runner.dll /opt/fitnesse/
COPY Runner.runtimeconfig.json /opt/fitnesse/
COPY Suite.config /opt/fitnesse/
COPY AcceptanceTests.dll /opt/fitnesse/

WORKDIR /opt/fitnesse
VOLUME /opt/fitnesse
USER fitnesse
ENTRYPOINT ["java", "-Xmx256m", "-jar", "/usr/local/lib/fitnesse-standalone.jar", "-p", "8080"]
EXPOSE 8080

Run the container from powershell

docker build -t fitnesse .
docker run --rm -d --name fitnesse -p 8080:8080 -v $PWD/data:/opt/fitnesse fitnesse:latest

Create the following test...

!contents -R2 -g -p -f -h
!path /opt/fitnesse/AcceptanceTests.dll
!define COMMAND_PATTERN {%m /opt/fitnesse/Runner.dll -c /opt/fitnesse/Suite.config %p}
!define TEST_RUNNER {dotnet}
!|AcceptanceTests.MyAcceptanceTests|
|FirstString|SecondString|Concatenate?|
|Hello      |World       |Hello World |
|Steve      |Fenton      |Steve Fenton|

Get the following error...

fit:dotnet
Test page:  AcceptanceTests
Command:    dotnet /opt/fitnesse/Runner.dll -c /opt/fitnesse/Suite.config defaultPath d4f8b1899512 35869 3863
Exit code:  1
Time elapsed:   1 seconds
Standard Error:
No executable found matching command "dotnet-/opt/fitnesse/Runner.dll"
Internal Exceptions:
FitClient external process terminated before a connection could be established
FitClient external process terminated before a connection could be established
essenius commented 4 years ago

Have you tried removing the %p from the command pattern? That seems to introduce defaultPath in the command, which might mess things up.

jediwhale commented 4 years ago

I haven't tried fitnesse on linux yet but I was able to run fitSharp from terminal: e.g. dotnet ~/.nuget/packages/fitsharp/2.7.1.1/lib/netcoreapp3.1/Runner.dll -c sample.config.xml where sample.config.xml is:

<suiteConfig>
    <ApplicationUnderTest>
        <AddAssembly>./bin/Debug/netcoreapp3.1/SampleSUT.dll</AddAssembly>
        <AddNamespace>SampleSUT</AddNamespace>
    </ApplicationUnderTest>
    <Settings>
        <InputFolder>./tests/in</InputFolder>
        <OutputFolder>./tests/out</OutputFolder>
        <Runner>fit.Runner.FolderRunner</Runner>
    </Settings>
</suiteConfig>
pb1981 commented 4 years ago

As long as you have mono and java installed, fitnesse works fine in Linux as well. I have run Testcases in Ubuntu using Chrome Browser(with out using docker image of fitnesse).

Start the TestServer: ./launchTestCaseServer.sh which includes java -jar fitnesse-standalone.jar -p 9091 -e 0

For Running Runner executable: mono ./Runner.exe -c SUT.config.xml 9999 where SUT.config.xml has below:

SUT_config

TestSuite should have below global variables defined: !define SLIM_HOST {127.0.0.1} -> IP of Machine where Runner is running !define SLIM_PORT {9999} !define SLIM_POOL_SIZE {1} !define SLIM_VERSION {0.0} !define TEST_SYSTEM {slim} !define MANUALLY_START_TEST_RUNNER_ON_DEBUG {true} !define FILTER_TOC {true}

pb1981 commented 4 years ago

@sgtobin Is your problem solved for Linux Setup ? or you are still facing same issue or some different issue?

jediwhale commented 3 years ago

Tested successfully with netcore 3.1 and net 5.0 on linux