The development of quantum computers represents a breakthrough in the evolution of computing. Their graceful processing capacity will help to solve some problems impossible until now because the algorithms that calculate their solution require too much amount of memory or processing time. In portfolio theory, the investment portfolio optimization problem is one of those problems whose complexity grows exponentially with the number of assets. In this work we analyze the Variational Quantum Eigensolver algorithm, applied to solve the portfolio optimization problem, running on simulators and real quantum computers from IBM. We compare the results with three other classical algorithms for the same problem, running one equivalent condition. By backtesting classical and quantum computing algorithms, we can get a sense of how these algorithms might perform in the real world. This work explores the backtesting of quantum and classical computing algorithms for portfolio optimization and compares the results. The benefits and drawbacks of backtesting are discussed, as well as some of the challenges involved in using real quantum computers of more than 100 qubits. Results show quantum algorithms can be competitive with classical ones, with the advantage of being able to handle a large number of assets in a reasonable time on a future larger quantum computer.