Path-based testing is an established method for creating test cases comprising sequences of steps executed in a System Under Test (SUT). Several algorithms for generating the test sequences (paths) that satisfy various test coverage criteria determining their properties are published in the literature. However, existing path-based testing techniques have limited applicability in numerous practical cases, such as when executing a particular test step in the test further excludes the execution of another test step. More complex exclusion requirements (further denoted negative constraints) exist in real systems, depending on the number of executions of a particular test step. In the paper, we discuss two possible negative constraints, namely, (1) the complete exclusion of a step as a consequence of the execution of a particular previous step and (2) the requirement to include a particular step maximally once in one test path, when another step was executed previously. We present a novel ant-colony-optimization (ACO) principle-based algorithm, accepting a SUT model based and a set of negative constraints, and computing a set of test paths while maximizing edge coverage and satisfying the given set of negative constraints. We compare the results of the ACO-based algorithm with those returned by a baseline, an alternative algorithm that excludes specific test paths from a set of test paths satisfying edge coverage, and, for reference, with results returned by an algorithm that generates test paths that satisfy edge coverage. Evaluated on 152 problem instances, the presented ACO-based algorithm outperformed the baseline in the average length of test paths (representing the testing costs) lower by 32.62%. Also, the ratio of edge coverage satisfaction in the set of test paths computed by the ACO-based algorithm is better by 3.41% compared to the baseline.