# Non-ide development

**URL:** <https://forums.fsharp.org/t/non-ide-development/2236>\
**Category:** General\
**Created:** [May 4, 2022, 11:57pm UTC](https://forums.fsharp.org/t/non-ide-development/2236 "2022-05-04T23:57:33Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonoke](https://avatars.discourse-cdn.com/v4/letter/j/a8b319/32.png) [@jonoke](https://forums.fsharp.org/u/jonoke)\
**Post date:** [May 4, 2022, 11:57pm UTC](https://forums.fsharp.org/t/non-ide-development/2236/1 "2022-05-04T23:57:33Z")

</div>

Hi,

I’ve been learning F# for a while and really love it.  
Now I’m ready to move past a simple one-thing project, and thought I’d do the “Ray Tracer Challenge” book but I’m getting lost on how to proceed with integrating testing into a project.  
My very strong preference is to use vi and command line tools - because that’s how I’ve been developing for 40yrs - but I can’t find much that explains how dotnet/F# projects fit together; every book I’ve looked at assumes you’ll be using and IDE, Visual Studio or similar.

If nothing else, I need to know how to add testing into a console app - that would get me started on the book.

So, can anyone point me to some good resources? Are there any good resources - or do I need to give up and find an IDE to hold my hand?

thanks  
Jonathan.

---

<div class="post-metadata">

**Author:** ![vcrobe](https://yyz2.discourse-cdn.com/flex030/user_avatar/forums.fsharp.org/vcrobe/32/1034_2.png) [@vcrobe](https://forums.fsharp.org/u/vcrobe)\
**Post date:** [May 5, 2022, 3:10am UTC](https://forums.fsharp.org/t/non-ide-development/2236/2 "2022-05-05T03:10:19Z")

</div>

Hi,

To work with the command line tools use the dotnet CLI (Command Line Interface). You can read about it here [dotnet CLI documentation](https://docs.microsoft.com/dotnet/core/tools/)

For CLI comands specific to F# read the [F# CLI documentation](https://docs.microsoft.com/dotnet/fsharp/get-started/get-started-command-line)

To create an F# Console application you can use the following command

`dotnet new console -lang "F#" -o ConsoleApp`

This command will create a directory/folder named ConsoleApp

Then you can go to the ConsoleApp directory/folder and run the app using the following command

`dotnet run`

you should see a text “Hello from F#”.

> [@jonoke](#):
>
> I need to know how to add testing into a console app

To add a testing project you can use the following command

`dotnet new xunit -o Tests`

This command create a new directory/folder named Tests and create a project using the xUnit framework to do tests. You can use MSTests or nUnit framework too.

To run the tests you can use the following command inside the foler Tests

`dotnet test`

**About the IDE**

If you don’t like to code with an IDE I would recommend you VS Code with the Ionide extension (to work with F#). It’s a ligthweight standalone source code editor that runs on Windows, macOS, and Linux with debugging capabilities. You should give it a try.

---

<div class="post-metadata">

**Author:** ![ntwilson](https://yyz2.discourse-cdn.com/flex030/user_avatar/forums.fsharp.org/ntwilson/32/984_2.png) [@ntwilson](https://forums.fsharp.org/u/ntwilson)\
**Post date:** [May 5, 2022, 2:56pm UTC](https://forums.fsharp.org/t/non-ide-development/2236/3 "2022-05-05T14:56:50Z")

</div>

You should definitely be able to make good progress without an IDE. Even when I use an IDE, I still really only use it for stuff like Go To Definition, and autocomplete and type definitions when I hover on stuff. I use the command line `dotnet` tool for managing projects & solutions, running tests, etc.

Now, the most oft recommended way to add tests is to have a separate project for the tests, which is pretty easy to setup. You can do `dotnet new --list -lang f#` to see all of the F#-compatible project templates available on your machine. (Personally I would recommend NUnit or XUnit and not MSTest, since MSTest seems to me especially tailored for C#). Once you have multiple projects, you probably want a “solution” to contain them. So I can do

```nohighlight
> dotnet new console -lang f# -n ProdProj
> dotnet new nunit -lang f# -n TestProj
> dotnet new sln -n MySolution
> dotnet sln add ProdProj
> dotnet sln add TestProj
> cd TestProj
> dotnet add reference ../ProdProj

```

(You probably have that first step already done for your console app). Now you can run `dotnet build` (or `dotnet build MySolution.sln`) to build both projects, or `dotnet test` to run all the tests in the test project.

Sometimes I do like to have my tests in the _same_ project, even if that’s not the recommended approach. What I would do in that case is take a look at the .fsproj that gets created when you run `dotnet new nunit -lang f#`, and figure out what things to port over to your prod project. In this case, I think the important bits are

```auto
  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
    <PackageReference Include="NUnit" Version="3.13.2" />
    <PackageReference Include="NUnit3TestAdapter" Version="4.0.0" />
    <PackageReference Include="coverlet.collector" Version="3.1.0" />
  </ItemGroup>

```

Copy that into your console app, and now you can add tests directly into that project.

As far as resources go, I mostly just use the `--help` docs with all the `dotnet` commands, and then just run google searches on any nodes in the fsproj that I don’t know what they do. There might be some nice comprehensive docs on that stuff, but I don’t know them. If you’re searching for fsproj details, you might want to sometimes try searching with “csproj” instead as your search term, since there’s probably 100x more resources for csproj stuff online, and the two have very similar structures.

---

<div class="post-metadata">

**Author:** ![chethusk](https://yyz2.discourse-cdn.com/flex030/user_avatar/forums.fsharp.org/chethusk/32/11_2.png) [@chethusk](https://forums.fsharp.org/u/chethusk)\
**Post date:** [May 5, 2022, 3:12pm UTC](https://forums.fsharp.org/t/non-ide-development/2236/4 "2022-05-05T15:12:54Z")

</div>

A good reference for the project file properties and items can be found on the SDK-specific pages [here](https://docs.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props). You can pick from the different main SDK types (Microsoft.NET.Sdk, Microsoft.NET.Sdk.Web, etc) on the left side to get more details.

![image](https://canada1.discourse-cdn.com/flex030/uploads/fsharp/original/2X/0/018fc1f63f651e9402cc731082816e2c9a963a93.png)

---

<div class="post-metadata">

**Author:** ![jonoke](https://avatars.discourse-cdn.com/v4/letter/j/a8b319/32.png) [@jonoke](https://forums.fsharp.org/u/jonoke)\
**Post date:** [May 6, 2022, 4:00am UTC](https://forums.fsharp.org/t/non-ide-development/2236/5 "2022-05-06T04:00:21Z")

</div>

Wow … thanks ntwilson for that - brilliant.  
I’ve got a project setup and ran a test and everything!

I can dig into F# deeper now.

Thanks

---

<div class="post-metadata">

**Author:** ![bmitc](https://yyz2.discourse-cdn.com/flex030/user_avatar/forums.fsharp.org/bmitc/32/1132_2.png) [@bmitc](https://forums.fsharp.org/u/bmitc)\
**Post date:** [November 8, 2022, 4:31am UTC](https://forums.fsharp.org/t/non-ide-development/2236/6 "2022-11-08T04:31:09Z")

</div>

If you are interested, I have implemented a decent amount of _The Ray Tracer Challenge_ book in F#. There’s a substantial amount of organization, documentation, and most importantly, tests. I use `FsUnit.Xunit` for my testing. I like the simple API provided by FsUnit, and I like the simpler aspect of xUnit over NUnit. (I just like declaring my tests as facts for whatever reason.)

> **[GitHub - bmitc/the-ray-tracer-challenge-fsharp: F# implementation of the ray...](https://github.com/bmitc/the-ray-tracer-challenge-fsharp)**
>
> F# implementation of the ray tracer found in The Ray Tracer Challenge by Jamis Buck - GitHub - bmitc/the-ray-tracer-challenge-fsharp: F# implementation of the ray tracer found in The Ray Tracer Cha...

If you’re in the `RayTracerChallenge` directory, the one with the `RayTracerChallenge.sln` solution file, then you can simply run `dotnet test` to run the tests. Like the others have said, the `dotnet` CLI is your friend for both non-IDE and IDE development.
