Build a timer that starts and stops timing when 2 wires are broken
You have a number of problems in your code. For one thing, you are doing a lot of printing:

void loop() {
  // check and read value of input:
  int sensorValue1 = digitalRead(7);
  int sensorValue2 = digitalRead(6);
  Serial.println(sensorValue1);
  Serial.println(sensorValue2);

  if (sensorValue1 = HIGH) {
    startTime = micros();
    Serial.println(sensorValue1);
  }
  if (sensorValue2 = HIGH) {
    stopTime = micros();
    Serial.println(sensorValue2);
  }
  unsigned long totalTime = (sensorValue1 - sensorValue2);
  String strPrint = strTime + totalTime;
  Serial.println(strPrint);      // prints "Time"

}


At 9600 baud each byte output takes 1/960 seconds (about 1 ms). A println adds a carriage-return/linefeed to what you are printing so I estimate:

3 + 3 + 7 + 7 = 20 bytes (20 ms)


That is every time around the loop! You will soon find the output buffer filling up, and thus are limiting the rate at which you can test times to be the nearest 20 ms which makes using micros() a bit redundant. You won't get that accuracy.



Plus, the String class does dynamic memory allocation which will slow things down. Why use String at all? For example, you can print "Time" like this:

Serial.println ("Time:");




Next, this assigns not compares:

  if (sensorValue1 = HIGH) {


That statement makes sensorValue1 HIGH (always) and then tests if it is true, which it always will be. You want:

  if (sensorValue1 == HIGH) {




Finally, as mentioned by Majenko, make the inputs INPUT_PULLUP and wire the other end to ground, like this:

  pinMode(7, INPUT_PULLUP);   // set up pin 7
  pinMode(6, INPUT_PULLUP);   // set up pin 6




Edit - after amended question.

// declare variables
unsigned long startTime, stopTime;
unsigned long totalTime = (stopTime - startTime);


You don't declare totalTime like that. It appears you want totalTime to eventually subtract startTime from stopTime.

Just declare totalTime without any calculations, and do the calculation when it is needed. eg.

// declare variables
unsigned long startTime, stopTime;
unsigned long totalTime;

...

  if (sensorValue2 == HIGH) {
    stopTime = micros();
    totalTime = stopTime - startTime;
    Serial.print ("Time: ");
    Serial.println (totalTime);
    }  // end of second sensor tripped


Note the "==" there, without it the code thinks both sensors tripped immediately.