Skip to content

Limitations and important notices

William Niemiec edited this page Sep 4, 2021 · 3 revisions

⚠ Important notices

  • If executing the test method does not generate the test path, run clean in the project.
  • Do not interrupt the test run before the following message is displayed: [INFO] Test path has been successfully computed. Otherwise, the source code file could be compromised. If this happens, see here how to restore the original file.
  • If the computation of the test path is stopped before it ends, the test class file will have changed code. When running the same test again, it will not run, as a note that disables the collectors has been added. See here how to restore the original file.
  • If there is any compilation error in the source file the test path will not be computed.
  • Test path of native java methods is not computed (like the size method from Lists package or the split method from String) class.
  • During the execution of the test method, the file containing the test class will change. At the end of the run, the original file will be restored. If not, see here how to restore the original file.
  • Test path will only be computed for methods and constructors called in test method.
  • If the message below is displayed while the application is running, just click continue (it informs you that the code was changed during execution).
eclipse_msg
- Do not modify the source file while the application is running, as this may interfere with file processing. - If a test method tests a method more than once, the test path order of the methods can be random.

Example

public class MultipleTestPaths 
{
	@Test
	public void ThreeTestPathsTest() 
	{
		AuxClass tc = new AuxClass(99);
		
		
		assertEquals("one", tc.threePaths(1));
		assertEquals("two", tc.threePaths(2));
		assertEquals("", tc.threePaths(3));
	}
}

In this example, the order of the test paths will not necessarily be relative to the order of invocation (tc.threePaths(1), tc.threePaths(2) and tc.threePaths(3)). This order can be different for each run.

🚫 Limitations

  • Test methods have to be public (does not work with other access modifiers like protected or default - although in JUnit 5 it works, in the application it doesn't, as the application works using the JUnit 4 API.
  • Incompatible with Gradle.
  • The project must contain a directory named src at the root of the project. This is because this directory is the reference that the application uses to know what the project's root directory is (it doesn't matter if this folder is empty, it must only exist in the project's root directory).
  • In tests that expect an exception, no test path of methods or constructors invoked below the location where the exception occurred is generated.
exception_no_tp
  • It is necessary that the source file of the method / constructor that will be generated the test path is available, that is, it is not enough to have only the compiled file to generate the test path. For example, if there is a method belonging to a downloaded library and only the compiled file of that method is available, its test path will not be generated.

  • If the same line is executed several times in a row, it will only appear once.

Example

inlineWhile

Input Literal path Generated test path
0 [156, 158] [156, 158]
1 [156, 156, 158] [156, 158]
2 [156, 156, 156, 158] [156, 158]
3 [156, 156, 156, 156, 158] [156, 158]
Clone this wiki locally