Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to handle tests that are not unit tests? #25

Open
cwollenhaupt opened this issue Jan 14, 2020 · 4 comments
Open

How to handle tests that are not unit tests? #25

cwollenhaupt opened this issue Jan 14, 2020 · 4 comments

Comments

@cwollenhaupt
Copy link
Contributor

Most of my tests are unit tests. They test a single class or a few couple classes in an isolated way that doesn't depend on a particular setup in my environment or database. Typically, all of these tests of a project are loaded in FoxUnit. I execute them all when I'm done with a ticket or change to make sure that everything still works. These tests execute relatively fast.

However, I also have other tests that are not independent. There are tests that communicate with live web services and ensure that the WSDL file hasn't changed or that the API is still working. These tests take considerably more time.

Currently I'm working on classes that use a document scanner, so my tests even include required hardware, a UI (select the scanner) and require specific setups (put two pages into the document feeder). These tests are great for development, because I don't have to run the application to test my code and I don't have to setup some test environment. However, they are totally unsuitable to run with my unit tests. Instead I call them on a case by case basis when I make changes or need to validate certain functionality.

I've considered defining a text file in the project folder that lists different Test folders with "Tests" being the default selected, the default when no text file exists and the default when tests are run automatically. However, when the text file exists and includes a line that is not "Tests", FoxUnit would display a dialog when launched and let the user pick a folder. This would impact the DataPath property in the FXU instance.

So basically, the Tests folder would contain all unit tests. But I could also create a folder "Integration Tests" or "Hardware Tests" with a separate set of loaded test classes.

Does that sound reasonable?

@eselje
Copy link
Collaborator

eselje commented Jan 14, 2020 via email

@cwollenhaupt
Copy link
Contributor Author

It's a FoxUnit test that looks like this:

Procedure Test_Scan
	Local loRef, laPages[1], lnCount
	loRef = NewObject("cUiWindowsImageAcquisition", ;
		"Klassen/cuiWindowsImageAcquisition.prg")
	lnCount = loRef.Scan (@laPages)
	This.AssertEquals ("C", Vartype (laPages[2]))
	This.AssertEquals (2, m.lnCount)

However, the Scan method will bring up several Windows WIA dialogs in the course of scanning and the test requires that there is a document feeder with two sheets of paper. So this isn't a test that I can run automatically whenever I commit a change in the app or whenever I build a release.

Currently I have to add the test to my list when I work on the program and remove it when I'm testing everything. That is a manual process and somewhat difficult to automate.

@eselje
Copy link
Collaborator

eselje commented Jan 14, 2020 via email

@cwollenhaupt
Copy link
Contributor Author

Yes, the assertions work just fine. Annotation is what .NET would do, I agree. In VFP that might be the test method name. I don't know how everyone else is naming their tests, but mine are all named Test_something. The filter would work, if I name the other tests IntegrationTest_something. That would work for interactive tests with one extra step. I have to think about how to handle automated tests without the FXU UI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants